From 1c4db695e26173ecdae42f43b8dde0bdcfded9a0 Mon Sep 17 00:00:00 2001 From: Mitsuru Mutaguchi Date: Thu, 1 May 2025 11:31:58 +0900 Subject: [PATCH 1/3] =?UTF-8?q?change:=20JS=E3=83=A9=E3=82=A4=E3=83=96?= =?UTF-8?q?=E3=83=A9=E3=83=AA,=20tinymce=E3=81=AEnpm=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=83=BC=E3=83=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 8 + package.json | 1 + public/js/707.js | 2 +- public/js/app.js | 2 +- public/mix-manifest.json | 2 +- resources/js/bootstrap.js | 50 + resources/js/tinymce/langs/README.md | 3 + resources/js/tinymce/langs/ja.js | 426 +++++ resources/js/tinymce/plugins/face/plugin.js | 151 ++ resources/js/tinymce/plugins/file/plugin.js | 250 +++ resources/js/tinymce/plugins/image/README.txt | 1 + resources/js/tinymce/plugins/image/plugin.js | 1699 +++++++++++++++++ resources/js/tinymce/plugins/pdf/plugin.js | 158 ++ .../js/tinymce/plugins/translate/plugin.js | 212 ++ .../views/plugins/common/wysiwyg.blade.php | 6 +- 15 files changed, 2967 insertions(+), 4 deletions(-) create mode 100644 resources/js/tinymce/langs/README.md create mode 100644 resources/js/tinymce/langs/ja.js create mode 100644 resources/js/tinymce/plugins/face/plugin.js create mode 100644 resources/js/tinymce/plugins/file/plugin.js create mode 100644 resources/js/tinymce/plugins/image/README.txt create mode 100644 resources/js/tinymce/plugins/image/plugin.js create mode 100644 resources/js/tinymce/plugins/pdf/plugin.js create mode 100644 resources/js/tinymce/plugins/translate/plugin.js diff --git a/package-lock.json b/package-lock.json index aca5aa886..716915553 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "sass": "^1.62.1", "sass-loader": "^12.6.0", "sortablejs": "^1.15.2", + "tinymce": "^5.8.0", "vue": "^3.5.13", "vue-loader": "^17.3.0" } @@ -10074,6 +10075,13 @@ "node": ">=0.6.0" } }, + "node_modules/tinymce": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-5.8.0.tgz", + "integrity": "sha512-1bOI3k+1D76rVjAJC3XkHezXJVghurnKBDREF1STHBLTQUY17XTbaDNJUxNgJqJHa2xg1udd5I1bzdfSd77DGw==", + "dev": true, + "license": "LGPL-2.1" + }, "node_modules/to-arraybuffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", diff --git a/package.json b/package.json index 75e7d9720..3d77d03c5 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "sass": "^1.62.1", "sass-loader": "^12.6.0", "sortablejs": "^1.15.2", + "tinymce": "^5.8.0", "vue": "^3.5.13", "vue-loader": "^17.3.0" } diff --git a/public/js/707.js b/public/js/707.js index dcb7808d1..debea43c4 100644 --- a/public/js/707.js +++ b/public/js/707.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[707],{707:(e,t,n)=>{function r(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function o(e){return e instanceof r(e).Element||e instanceof Element}function i(e){return e instanceof r(e).HTMLElement||e instanceof HTMLElement}function a(e){return"undefined"!=typeof ShadowRoot&&(e instanceof r(e).ShadowRoot||e instanceof ShadowRoot)}n.d(t,{createPopper:()=>he});var s=Math.max,f=Math.min,c=Math.round;function p(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function u(){return!/^((?!chrome|android).)*safari/i.test(p())}function l(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var a=e.getBoundingClientRect(),s=1,f=1;t&&i(e)&&(s=e.offsetWidth>0&&c(a.width)/e.offsetWidth||1,f=e.offsetHeight>0&&c(a.height)/e.offsetHeight||1);var p=(o(e)?r(e):window).visualViewport,l=!u()&&n,d=(a.left+(l&&p?p.offsetLeft:0))/s,h=(a.top+(l&&p?p.offsetTop:0))/f,m=a.width/s,v=a.height/f;return{width:m,height:v,top:h,right:d+m,bottom:h+v,left:d,x:d,y:h}}function d(e){var t=r(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function h(e){return e?(e.nodeName||"").toLowerCase():null}function m(e){return((o(e)?e.ownerDocument:e.document)||window.document).documentElement}function v(e){return l(m(e)).left+d(e).scrollLeft}function g(e){return r(e).getComputedStyle(e)}function y(e){var t=g(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function b(e,t,n){void 0===n&&(n=!1);var o,a,s=i(t),f=i(t)&&function(e){var t=e.getBoundingClientRect(),n=c(t.width)/e.offsetWidth||1,r=c(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(t),p=m(t),u=l(e,f,n),g={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(s||!s&&!n)&&(("body"!==h(t)||y(p))&&(g=(o=t)!==r(o)&&i(o)?{scrollLeft:(a=o).scrollLeft,scrollTop:a.scrollTop}:d(o)),i(t)?((b=l(t,!0)).x+=t.clientLeft,b.y+=t.clientTop):p&&(b.x=v(p))),{x:u.left+g.scrollLeft-b.x,y:u.top+g.scrollTop-b.y,width:u.width,height:u.height}}function w(e){var t=l(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function x(e){return"html"===h(e)?e:e.assignedSlot||e.parentNode||(a(e)?e.host:null)||m(e)}function O(e){return["html","body","#document"].indexOf(h(e))>=0?e.ownerDocument.body:i(e)&&y(e)?e:O(x(e))}function j(e,t){var n;void 0===t&&(t=[]);var o=O(e),i=o===(null==(n=e.ownerDocument)?void 0:n.body),a=r(o),s=i?[a].concat(a.visualViewport||[],y(o)?o:[]):o,f=t.concat(s);return i?f:f.concat(j(x(s)))}function E(e){return["table","td","th"].indexOf(h(e))>=0}function D(e){return i(e)&&"fixed"!==g(e).position?e.offsetParent:null}function A(e){for(var t=r(e),n=D(e);n&&E(n)&&"static"===g(n).position;)n=D(n);return n&&("html"===h(n)||"body"===h(n)&&"static"===g(n).position)?t:n||function(e){var t=/firefox/i.test(p());if(/Trident/i.test(p())&&i(e)&&"fixed"===g(e).position)return null;var n=x(e);for(a(n)&&(n=n.host);i(n)&&["html","body"].indexOf(h(n))<0;){var r=g(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}var k="top",L="bottom",P="right",W="left",M="auto",B=[k,L,P,W],H="start",R="end",T="viewport",C="popper",S=B.reduce((function(e,t){return e.concat([t+"-"+H,t+"-"+R])}),[]),V=[].concat(B,[M]).reduce((function(e,t){return e.concat([t,t+"-"+H,t+"-"+R])}),[]),q=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function N(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}var I={placement:"bottom",modifiers:[],strategy:"absolute"};function F(){for(var e=arguments.length,t=new Array(e),n=0;n=0?"x":"y"}function G(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?_(o):null,a=o?X(o):null,s=n.x+n.width/2-r.width/2,f=n.y+n.height/2-r.height/2;switch(i){case k:t={x:s,y:n.y-r.height};break;case L:t={x:s,y:n.y+n.height};break;case P:t={x:n.x+n.width,y:f};break;case W:t={x:n.x-r.width,y:f};break;default:t={x:n.x,y:n.y}}var c=i?Y(i):null;if(null!=c){var p="y"===c?"height":"width";switch(a){case H:t[c]=t[c]-(n[p]/2-r[p]/2);break;case R:t[c]=t[c]+(n[p]/2-r[p]/2)}}return t}var J={top:"auto",right:"auto",bottom:"auto",left:"auto"};function K(e){var t,n=e.popper,o=e.popperRect,i=e.placement,a=e.variation,s=e.offsets,f=e.position,p=e.gpuAcceleration,u=e.adaptive,l=e.roundOffsets,d=e.isFixed,h=s.x,v=void 0===h?0:h,y=s.y,b=void 0===y?0:y,w="function"==typeof l?l({x:v,y:b}):{x:v,y:b};v=w.x,b=w.y;var x=s.hasOwnProperty("x"),O=s.hasOwnProperty("y"),j=W,E=k,D=window;if(u){var M=A(n),B="clientHeight",H="clientWidth";if(M===r(n)&&"static"!==g(M=m(n)).position&&"absolute"===f&&(B="scrollHeight",H="scrollWidth"),i===k||(i===W||i===P)&&a===R)E=L,b-=(d&&M===D&&D.visualViewport?D.visualViewport.height:M[B])-o.height,b*=p?1:-1;if(i===W||(i===k||i===L)&&a===R)j=P,v-=(d&&M===D&&D.visualViewport?D.visualViewport.width:M[H])-o.width,v*=p?1:-1}var T,C=Object.assign({position:f},u&&J),S=!0===l?function(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:c(n*o)/o||0,y:c(r*o)/o||0}}({x:v,y:b},r(n)):{x:v,y:b};return v=S.x,b=S.y,p?Object.assign({},C,((T={})[E]=O?"0":"",T[j]=x?"0":"",T.transform=(D.devicePixelRatio||1)<=1?"translate("+v+"px, "+b+"px)":"translate3d("+v+"px, "+b+"px, 0)",T)):Object.assign({},C,((t={})[E]=O?b+"px":"",t[j]=x?v+"px":"",t.transform="",t))}const Q={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,a=V.reduce((function(e,n){return e[n]=function(e,t,n){var r=_(e),o=[W,k].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[W,P].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e}),{}),s=a[t.placement],f=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}};var Z={left:"right",right:"left",bottom:"top",top:"bottom"};function $(e){return e.replace(/left|right|bottom|top/g,(function(e){return Z[e]}))}var ee={start:"end",end:"start"};function te(e){return e.replace(/start|end/g,(function(e){return ee[e]}))}function ne(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&a(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function re(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function oe(e,t,n){return t===T?re(function(e,t){var n=r(e),o=m(e),i=n.visualViewport,a=o.clientWidth,s=o.clientHeight,f=0,c=0;if(i){a=i.width,s=i.height;var p=u();(p||!p&&"fixed"===t)&&(f=i.offsetLeft,c=i.offsetTop)}return{width:a,height:s,x:f+v(e),y:c}}(e,n)):o(t)?function(e,t){var n=l(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):re(function(e){var t,n=m(e),r=d(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=s(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=s(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),f=-r.scrollLeft+v(e),c=-r.scrollTop;return"rtl"===g(o||n).direction&&(f+=s(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:f,y:c}}(m(e)))}function ie(e,t,n,r){var a="clippingParents"===t?function(e){var t=j(x(e)),n=["absolute","fixed"].indexOf(g(e).position)>=0&&i(e)?A(e):e;return o(n)?t.filter((function(e){return o(e)&&ne(e,n)&&"body"!==h(e)})):[]}(e):[].concat(t),c=[].concat(a,[n]),p=c[0],u=c.reduce((function(t,n){var o=oe(e,n,r);return t.top=s(o.top,t.top),t.right=f(o.right,t.right),t.bottom=f(o.bottom,t.bottom),t.left=s(o.left,t.left),t}),oe(e,p,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function ae(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function se(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function fe(e,t){void 0===t&&(t={});var n=t,r=n.placement,i=void 0===r?e.placement:r,a=n.strategy,s=void 0===a?e.strategy:a,f=n.boundary,c=void 0===f?"clippingParents":f,p=n.rootBoundary,u=void 0===p?T:p,d=n.elementContext,h=void 0===d?C:d,v=n.altBoundary,g=void 0!==v&&v,y=n.padding,b=void 0===y?0:y,w=ae("number"!=typeof b?b:se(b,B)),x=h===C?"reference":C,O=e.rects.popper,j=e.elements[g?x:h],E=ie(o(j)?j:j.contextElement||m(e.elements.popper),c,u,s),D=l(e.elements.reference),A=G({reference:D,element:O,strategy:"absolute",placement:i}),W=re(Object.assign({},O,A)),M=h===C?W:D,H={top:E.top-M.top+w.top,bottom:M.bottom-E.bottom+w.bottom,left:E.left-M.left+w.left,right:M.right-E.right+w.right},R=e.modifiersData.offset;if(h===C&&R){var S=R[i];Object.keys(H).forEach((function(e){var t=[P,L].indexOf(e)>=0?1:-1,n=[k,L].indexOf(e)>=0?"y":"x";H[e]+=S[n]*t}))}return H}function ce(e,t,n){return s(e,f(t,n))}const pe={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,i=void 0===o||o,a=n.altAxis,c=void 0!==a&&a,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.padding,h=n.tether,m=void 0===h||h,v=n.tetherOffset,g=void 0===v?0:v,y=fe(t,{boundary:p,rootBoundary:u,padding:d,altBoundary:l}),b=_(t.placement),x=X(t.placement),O=!x,j=Y(b),E="x"===j?"y":"x",D=t.modifiersData.popperOffsets,M=t.rects.reference,B=t.rects.popper,R="function"==typeof g?g(Object.assign({},t.rects,{placement:t.placement})):g,T="number"==typeof R?{mainAxis:R,altAxis:R}:Object.assign({mainAxis:0,altAxis:0},R),C=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,S={x:0,y:0};if(D){if(i){var V,q="y"===j?k:W,N="y"===j?L:P,I="y"===j?"height":"width",F=D[j],U=F+y[q],z=F-y[N],G=m?-B[I]/2:0,J=x===H?M[I]:B[I],K=x===H?-B[I]:-M[I],Q=t.elements.arrow,Z=m&&Q?w(Q):{width:0,height:0},$=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},ee=$[q],te=$[N],ne=ce(0,M[I],Z[I]),re=O?M[I]/2-G-ne-ee-T.mainAxis:J-ne-ee-T.mainAxis,oe=O?-M[I]/2+G+ne+te+T.mainAxis:K+ne+te+T.mainAxis,ie=t.elements.arrow&&A(t.elements.arrow),ae=ie?"y"===j?ie.clientTop||0:ie.clientLeft||0:0,se=null!=(V=null==C?void 0:C[j])?V:0,pe=F+oe-se,ue=ce(m?f(U,F+re-se-ae):U,F,m?s(z,pe):z);D[j]=ue,S[j]=ue-F}if(c){var le,de="x"===j?k:W,he="x"===j?L:P,me=D[E],ve="y"===E?"height":"width",ge=me+y[de],ye=me-y[he],be=-1!==[k,W].indexOf(b),we=null!=(le=null==C?void 0:C[E])?le:0,xe=be?ge:me-M[ve]-B[ve]-we+T.altAxis,Oe=be?me+M[ve]+B[ve]-we-T.altAxis:ye,je=m&&be?function(e,t,n){var r=ce(e,t,n);return r>n?n:r}(xe,me,Oe):ce(m?xe:ge,me,m?Oe:ye);D[E]=je,S[E]=je-me}t.modifiersData[r]=S}},requiresIfExists:["offset"]};const ue={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=_(n.placement),f=Y(s),c=[W,P].indexOf(s)>=0?"height":"width";if(i&&a){var p=function(e,t){return ae("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:se(e,B))}(o.padding,n),u=w(i),l="y"===f?k:W,d="y"===f?L:P,h=n.rects.reference[c]+n.rects.reference[f]-a[f]-n.rects.popper[c],m=a[f]-n.rects.reference[f],v=A(i),g=v?"y"===f?v.clientHeight||0:v.clientWidth||0:0,y=h/2-m/2,b=p[l],x=g-u[c]-p[d],O=g/2-u[c]/2+y,j=ce(b,O,x),E=f;n.modifiersData[r]=((t={})[E]=j,t.centerOffset=j-O,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&ne(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function le(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function de(e){return[k,P,L,W].some((function(t){return e[t]>=0}))}var he=U({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,o=e.options,i=o.scroll,a=void 0===i||i,s=o.resize,f=void 0===s||s,c=r(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&p.forEach((function(e){e.addEventListener("scroll",n.update,z)})),f&&c.addEventListener("resize",n.update,z),function(){a&&p.forEach((function(e){e.removeEventListener("scroll",n.update,z)})),f&&c.removeEventListener("resize",n.update,z)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=G({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i,s=n.roundOffsets,f=void 0===s||s,c={placement:_(t.placement),variation:X(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,K(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:f})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,K(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];i(o)&&h(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});i(r)&&h(r)&&(Object.assign(r.style,a),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]},Q,{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0===a||a,f=n.fallbackPlacements,c=n.padding,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.flipVariations,h=void 0===d||d,m=n.allowedAutoPlacements,v=t.options.placement,g=_(v),y=f||(g===v||!h?[$(v)]:function(e){if(_(e)===M)return[];var t=$(e);return[te(e),t,te(t)]}(v)),b=[v].concat(y).reduce((function(e,n){return e.concat(_(n)===M?function(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=void 0===f?V:f,p=X(r),u=p?s?S:S.filter((function(e){return X(e)===p})):B,l=u.filter((function(e){return c.indexOf(e)>=0}));0===l.length&&(l=u);var d=l.reduce((function(t,n){return t[n]=fe(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[_(n)],t}),{});return Object.keys(d).sort((function(e,t){return d[e]-d[t]}))}(t,{placement:n,boundary:p,rootBoundary:u,padding:c,flipVariations:h,allowedAutoPlacements:m}):n)}),[]),w=t.rects.reference,x=t.rects.popper,O=new Map,j=!0,E=b[0],D=0;D=0,q=C?"width":"height",N=fe(t,{placement:A,boundary:p,rootBoundary:u,altBoundary:l,padding:c}),I=C?T?P:W:T?L:k;w[q]>x[q]&&(I=$(I));var F=$(I),U=[];if(i&&U.push(N[R]<=0),s&&U.push(N[I]<=0,N[F]<=0),U.every((function(e){return e}))){E=A,j=!1;break}O.set(A,U)}if(j)for(var z=function(e){var t=b.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return E=t,"break"},Y=h?3:1;Y>0;Y--){if("break"===z(Y))break}t.placement!==E&&(t.modifiersData[r]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},pe,ue,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=fe(t,{elementContext:"reference"}),s=fe(t,{altBoundary:!0}),f=le(a,r),c=le(s,o,i),p=de(f),u=de(c);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:p,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":u})}}]})}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[707],{8707:(e,t,n)=>{function r(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function o(e){return e instanceof r(e).Element||e instanceof Element}function i(e){return e instanceof r(e).HTMLElement||e instanceof HTMLElement}function a(e){return"undefined"!=typeof ShadowRoot&&(e instanceof r(e).ShadowRoot||e instanceof ShadowRoot)}n.d(t,{createPopper:()=>he});var s=Math.max,f=Math.min,c=Math.round;function p(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function u(){return!/^((?!chrome|android).)*safari/i.test(p())}function l(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var a=e.getBoundingClientRect(),s=1,f=1;t&&i(e)&&(s=e.offsetWidth>0&&c(a.width)/e.offsetWidth||1,f=e.offsetHeight>0&&c(a.height)/e.offsetHeight||1);var p=(o(e)?r(e):window).visualViewport,l=!u()&&n,d=(a.left+(l&&p?p.offsetLeft:0))/s,h=(a.top+(l&&p?p.offsetTop:0))/f,m=a.width/s,v=a.height/f;return{width:m,height:v,top:h,right:d+m,bottom:h+v,left:d,x:d,y:h}}function d(e){var t=r(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function h(e){return e?(e.nodeName||"").toLowerCase():null}function m(e){return((o(e)?e.ownerDocument:e.document)||window.document).documentElement}function v(e){return l(m(e)).left+d(e).scrollLeft}function g(e){return r(e).getComputedStyle(e)}function y(e){var t=g(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function b(e,t,n){void 0===n&&(n=!1);var o,a,s=i(t),f=i(t)&&function(e){var t=e.getBoundingClientRect(),n=c(t.width)/e.offsetWidth||1,r=c(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(t),p=m(t),u=l(e,f,n),g={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(s||!s&&!n)&&(("body"!==h(t)||y(p))&&(g=(o=t)!==r(o)&&i(o)?{scrollLeft:(a=o).scrollLeft,scrollTop:a.scrollTop}:d(o)),i(t)?((b=l(t,!0)).x+=t.clientLeft,b.y+=t.clientTop):p&&(b.x=v(p))),{x:u.left+g.scrollLeft-b.x,y:u.top+g.scrollTop-b.y,width:u.width,height:u.height}}function w(e){var t=l(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function x(e){return"html"===h(e)?e:e.assignedSlot||e.parentNode||(a(e)?e.host:null)||m(e)}function O(e){return["html","body","#document"].indexOf(h(e))>=0?e.ownerDocument.body:i(e)&&y(e)?e:O(x(e))}function j(e,t){var n;void 0===t&&(t=[]);var o=O(e),i=o===(null==(n=e.ownerDocument)?void 0:n.body),a=r(o),s=i?[a].concat(a.visualViewport||[],y(o)?o:[]):o,f=t.concat(s);return i?f:f.concat(j(x(s)))}function E(e){return["table","td","th"].indexOf(h(e))>=0}function D(e){return i(e)&&"fixed"!==g(e).position?e.offsetParent:null}function A(e){for(var t=r(e),n=D(e);n&&E(n)&&"static"===g(n).position;)n=D(n);return n&&("html"===h(n)||"body"===h(n)&&"static"===g(n).position)?t:n||function(e){var t=/firefox/i.test(p());if(/Trident/i.test(p())&&i(e)&&"fixed"===g(e).position)return null;var n=x(e);for(a(n)&&(n=n.host);i(n)&&["html","body"].indexOf(h(n))<0;){var r=g(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}var k="top",L="bottom",P="right",W="left",M="auto",B=[k,L,P,W],H="start",R="end",T="viewport",C="popper",S=B.reduce((function(e,t){return e.concat([t+"-"+H,t+"-"+R])}),[]),V=[].concat(B,[M]).reduce((function(e,t){return e.concat([t,t+"-"+H,t+"-"+R])}),[]),q=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function N(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}var I={placement:"bottom",modifiers:[],strategy:"absolute"};function F(){for(var e=arguments.length,t=new Array(e),n=0;n=0?"x":"y"}function G(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?_(o):null,a=o?X(o):null,s=n.x+n.width/2-r.width/2,f=n.y+n.height/2-r.height/2;switch(i){case k:t={x:s,y:n.y-r.height};break;case L:t={x:s,y:n.y+n.height};break;case P:t={x:n.x+n.width,y:f};break;case W:t={x:n.x-r.width,y:f};break;default:t={x:n.x,y:n.y}}var c=i?Y(i):null;if(null!=c){var p="y"===c?"height":"width";switch(a){case H:t[c]=t[c]-(n[p]/2-r[p]/2);break;case R:t[c]=t[c]+(n[p]/2-r[p]/2)}}return t}var J={top:"auto",right:"auto",bottom:"auto",left:"auto"};function K(e){var t,n=e.popper,o=e.popperRect,i=e.placement,a=e.variation,s=e.offsets,f=e.position,p=e.gpuAcceleration,u=e.adaptive,l=e.roundOffsets,d=e.isFixed,h=s.x,v=void 0===h?0:h,y=s.y,b=void 0===y?0:y,w="function"==typeof l?l({x:v,y:b}):{x:v,y:b};v=w.x,b=w.y;var x=s.hasOwnProperty("x"),O=s.hasOwnProperty("y"),j=W,E=k,D=window;if(u){var M=A(n),B="clientHeight",H="clientWidth";if(M===r(n)&&"static"!==g(M=m(n)).position&&"absolute"===f&&(B="scrollHeight",H="scrollWidth"),i===k||(i===W||i===P)&&a===R)E=L,b-=(d&&M===D&&D.visualViewport?D.visualViewport.height:M[B])-o.height,b*=p?1:-1;if(i===W||(i===k||i===L)&&a===R)j=P,v-=(d&&M===D&&D.visualViewport?D.visualViewport.width:M[H])-o.width,v*=p?1:-1}var T,C=Object.assign({position:f},u&&J),S=!0===l?function(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:c(n*o)/o||0,y:c(r*o)/o||0}}({x:v,y:b},r(n)):{x:v,y:b};return v=S.x,b=S.y,p?Object.assign({},C,((T={})[E]=O?"0":"",T[j]=x?"0":"",T.transform=(D.devicePixelRatio||1)<=1?"translate("+v+"px, "+b+"px)":"translate3d("+v+"px, "+b+"px, 0)",T)):Object.assign({},C,((t={})[E]=O?b+"px":"",t[j]=x?v+"px":"",t.transform="",t))}const Q={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,a=V.reduce((function(e,n){return e[n]=function(e,t,n){var r=_(e),o=[W,k].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[W,P].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e}),{}),s=a[t.placement],f=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}};var Z={left:"right",right:"left",bottom:"top",top:"bottom"};function $(e){return e.replace(/left|right|bottom|top/g,(function(e){return Z[e]}))}var ee={start:"end",end:"start"};function te(e){return e.replace(/start|end/g,(function(e){return ee[e]}))}function ne(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&a(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function re(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function oe(e,t,n){return t===T?re(function(e,t){var n=r(e),o=m(e),i=n.visualViewport,a=o.clientWidth,s=o.clientHeight,f=0,c=0;if(i){a=i.width,s=i.height;var p=u();(p||!p&&"fixed"===t)&&(f=i.offsetLeft,c=i.offsetTop)}return{width:a,height:s,x:f+v(e),y:c}}(e,n)):o(t)?function(e,t){var n=l(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(t,n):re(function(e){var t,n=m(e),r=d(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=s(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=s(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),f=-r.scrollLeft+v(e),c=-r.scrollTop;return"rtl"===g(o||n).direction&&(f+=s(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:f,y:c}}(m(e)))}function ie(e,t,n,r){var a="clippingParents"===t?function(e){var t=j(x(e)),n=["absolute","fixed"].indexOf(g(e).position)>=0&&i(e)?A(e):e;return o(n)?t.filter((function(e){return o(e)&&ne(e,n)&&"body"!==h(e)})):[]}(e):[].concat(t),c=[].concat(a,[n]),p=c[0],u=c.reduce((function(t,n){var o=oe(e,n,r);return t.top=s(o.top,t.top),t.right=f(o.right,t.right),t.bottom=f(o.bottom,t.bottom),t.left=s(o.left,t.left),t}),oe(e,p,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function ae(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function se(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function fe(e,t){void 0===t&&(t={});var n=t,r=n.placement,i=void 0===r?e.placement:r,a=n.strategy,s=void 0===a?e.strategy:a,f=n.boundary,c=void 0===f?"clippingParents":f,p=n.rootBoundary,u=void 0===p?T:p,d=n.elementContext,h=void 0===d?C:d,v=n.altBoundary,g=void 0!==v&&v,y=n.padding,b=void 0===y?0:y,w=ae("number"!=typeof b?b:se(b,B)),x=h===C?"reference":C,O=e.rects.popper,j=e.elements[g?x:h],E=ie(o(j)?j:j.contextElement||m(e.elements.popper),c,u,s),D=l(e.elements.reference),A=G({reference:D,element:O,strategy:"absolute",placement:i}),W=re(Object.assign({},O,A)),M=h===C?W:D,H={top:E.top-M.top+w.top,bottom:M.bottom-E.bottom+w.bottom,left:E.left-M.left+w.left,right:M.right-E.right+w.right},R=e.modifiersData.offset;if(h===C&&R){var S=R[i];Object.keys(H).forEach((function(e){var t=[P,L].indexOf(e)>=0?1:-1,n=[k,L].indexOf(e)>=0?"y":"x";H[e]+=S[n]*t}))}return H}function ce(e,t,n){return s(e,f(t,n))}const pe={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,i=void 0===o||o,a=n.altAxis,c=void 0!==a&&a,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.padding,h=n.tether,m=void 0===h||h,v=n.tetherOffset,g=void 0===v?0:v,y=fe(t,{boundary:p,rootBoundary:u,padding:d,altBoundary:l}),b=_(t.placement),x=X(t.placement),O=!x,j=Y(b),E="x"===j?"y":"x",D=t.modifiersData.popperOffsets,M=t.rects.reference,B=t.rects.popper,R="function"==typeof g?g(Object.assign({},t.rects,{placement:t.placement})):g,T="number"==typeof R?{mainAxis:R,altAxis:R}:Object.assign({mainAxis:0,altAxis:0},R),C=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,S={x:0,y:0};if(D){if(i){var V,q="y"===j?k:W,N="y"===j?L:P,I="y"===j?"height":"width",F=D[j],U=F+y[q],z=F-y[N],G=m?-B[I]/2:0,J=x===H?M[I]:B[I],K=x===H?-B[I]:-M[I],Q=t.elements.arrow,Z=m&&Q?w(Q):{width:0,height:0},$=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},ee=$[q],te=$[N],ne=ce(0,M[I],Z[I]),re=O?M[I]/2-G-ne-ee-T.mainAxis:J-ne-ee-T.mainAxis,oe=O?-M[I]/2+G+ne+te+T.mainAxis:K+ne+te+T.mainAxis,ie=t.elements.arrow&&A(t.elements.arrow),ae=ie?"y"===j?ie.clientTop||0:ie.clientLeft||0:0,se=null!=(V=null==C?void 0:C[j])?V:0,pe=F+oe-se,ue=ce(m?f(U,F+re-se-ae):U,F,m?s(z,pe):z);D[j]=ue,S[j]=ue-F}if(c){var le,de="x"===j?k:W,he="x"===j?L:P,me=D[E],ve="y"===E?"height":"width",ge=me+y[de],ye=me-y[he],be=-1!==[k,W].indexOf(b),we=null!=(le=null==C?void 0:C[E])?le:0,xe=be?ge:me-M[ve]-B[ve]-we+T.altAxis,Oe=be?me+M[ve]+B[ve]-we-T.altAxis:ye,je=m&&be?function(e,t,n){var r=ce(e,t,n);return r>n?n:r}(xe,me,Oe):ce(m?xe:ge,me,m?Oe:ye);D[E]=je,S[E]=je-me}t.modifiersData[r]=S}},requiresIfExists:["offset"]};const ue={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=_(n.placement),f=Y(s),c=[W,P].indexOf(s)>=0?"height":"width";if(i&&a){var p=function(e,t){return ae("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:se(e,B))}(o.padding,n),u=w(i),l="y"===f?k:W,d="y"===f?L:P,h=n.rects.reference[c]+n.rects.reference[f]-a[f]-n.rects.popper[c],m=a[f]-n.rects.reference[f],v=A(i),g=v?"y"===f?v.clientHeight||0:v.clientWidth||0:0,y=h/2-m/2,b=p[l],x=g-u[c]-p[d],O=g/2-u[c]/2+y,j=ce(b,O,x),E=f;n.modifiersData[r]=((t={})[E]=j,t.centerOffset=j-O,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&ne(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function le(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function de(e){return[k,P,L,W].some((function(t){return e[t]>=0}))}var he=U({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,o=e.options,i=o.scroll,a=void 0===i||i,s=o.resize,f=void 0===s||s,c=r(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&p.forEach((function(e){e.addEventListener("scroll",n.update,z)})),f&&c.addEventListener("resize",n.update,z),function(){a&&p.forEach((function(e){e.removeEventListener("scroll",n.update,z)})),f&&c.removeEventListener("resize",n.update,z)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=G({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i,s=n.roundOffsets,f=void 0===s||s,c={placement:_(t.placement),variation:X(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,K(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:f})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,K(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];i(o)&&h(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});i(r)&&h(r)&&(Object.assign(r.style,a),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]},Q,{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0===a||a,f=n.fallbackPlacements,c=n.padding,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.flipVariations,h=void 0===d||d,m=n.allowedAutoPlacements,v=t.options.placement,g=_(v),y=f||(g===v||!h?[$(v)]:function(e){if(_(e)===M)return[];var t=$(e);return[te(e),t,te(t)]}(v)),b=[v].concat(y).reduce((function(e,n){return e.concat(_(n)===M?function(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=void 0===f?V:f,p=X(r),u=p?s?S:S.filter((function(e){return X(e)===p})):B,l=u.filter((function(e){return c.indexOf(e)>=0}));0===l.length&&(l=u);var d=l.reduce((function(t,n){return t[n]=fe(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[_(n)],t}),{});return Object.keys(d).sort((function(e,t){return d[e]-d[t]}))}(t,{placement:n,boundary:p,rootBoundary:u,padding:c,flipVariations:h,allowedAutoPlacements:m}):n)}),[]),w=t.rects.reference,x=t.rects.popper,O=new Map,j=!0,E=b[0],D=0;D=0,q=C?"width":"height",N=fe(t,{placement:A,boundary:p,rootBoundary:u,altBoundary:l,padding:c}),I=C?T?P:W:T?L:k;w[q]>x[q]&&(I=$(I));var F=$(I),U=[];if(i&&U.push(N[R]<=0),s&&U.push(N[I]<=0,N[F]<=0),U.every((function(e){return e}))){E=A,j=!1;break}O.set(A,U)}if(j)for(var z=function(e){var t=b.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return E=t,"break"},Y=h?3:1;Y>0;Y--){if("break"===z(Y))break}t.placement!==E&&(t.modifiersData[r]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},pe,ue,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=fe(t,{elementContext:"reference"}),s=fe(t,{altBoundary:!0}),f=le(a,r),c=le(s,o,i),p=de(f),u=de(c);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:p,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":u})}}]})}}]); \ No newline at end of file diff --git a/public/js/app.js b/public/js/app.js index b11b2de36..b6cdf015a 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1,2 +1,2 @@ /*! For license information please see app.js.LICENSE.txt */ -(()=>{var t,e,n={196:(t,e,n)=>{"use strict";let i=[],r=[];function o(t){if(t<768)return!1;for(let e=0,n=i.length;;){let o=e+n>>1;if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,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((t=>t?parseInt(t,36):1));for(let e=0,n=0;e=0&&s(O(t,i));)n++,i-=2;if(n%2==0)break;e+=2}}}return e}function c(t,e,n){for(;e>0;){let i=l(t,e-2,n);if(i=56320&&t<57344}function u(t){return t>=55296&&t<56320}function d(t){return t<65536?1:2}class f{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,n){[t,e]=b(this,t,e);let i=[];return this.decompose(0,t,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(e,this.length,i,1),m.from(i,this.length-(e-t)+n.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=b(this,t,e);let n=[];return this.decompose(t,e,n,0),m.from(n,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),n=this.length-this.scanIdentical(t,-1),i=new v(this),r=new v(t);for(let t=e,o=e;;){if(i.next(t),r.next(t),t=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(o+=i.value.length,i.done||o>=n)return!0}}iter(t=1){return new v(this,t)}iterRange(t,e=this.length){return new $(this,t,e)}iterLines(t,e){let n;if(null==t)n=this.iter();else{null==e&&(e=this.lines+1);let i=this.line(t).from;n=this.iterRange(i,Math.max(i,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new Q(n)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(0==t.length)throw new RangeError("A document must have at least one line");return 1!=t.length||t[0]?t.length<=32?new p(t):m.from(p.split(t,[])):f.empty}}class p extends f{constructor(t,e=function(t){let e=-1;for(let n of t)e+=n.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,n,i){for(let r=0;;r++){let o=this.text[r],s=i+o.length;if((e?n:s)>=t)return new S(i,s,n,o);i=s+1,n++}}decompose(t,e,n,i){let r=t<=0&&e>=this.length?this:new p(y(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(1&i){let t=n.pop(),e=g(r.text,t.text.slice(),0,r.length);if(e.length<=32)n.push(new p(e,t.length+r.length));else{let t=e.length>>1;n.push(new p(e.slice(0,t)),new p(e.slice(t)))}}else n.push(r)}replace(t,e,n){if(!(n instanceof p))return super.replace(t,e,n);[t,e]=b(this,t,e);let i=g(this.text,g(n.text,y(this.text,0,t)),e),r=this.length+n.length-(e-t);return i.length<=32?new p(i,r):m.from(p.split(i,[]),r)}sliceString(t,e=this.length,n="\n"){[t,e]=b(this,t,e);let i="";for(let r=0,o=0;r<=e&&ot&&o&&(i+=n),tr&&(i+=s.slice(Math.max(0,t-r),e-r)),r=a+1}return i}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let n=[],i=-1;for(let r of t)n.push(r),i+=r.length+1,32==n.length&&(e.push(new p(n,i)),n=[],i=-1);return i>-1&&e.push(new p(n,i)),e}}class m extends f{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,n,i){for(let r=0;;r++){let o=this.children[r],s=i+o.length,a=n+o.lines-1;if((e?a:s)>=t)return o.lineInner(t,e,n,i);i=s+1,n=a+1}}decompose(t,e,n,i){for(let r=0,o=0;o<=e&&r=o){let r=i&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!r?n.push(s):s.decompose(t-o,e-o,n,r)}o=a+1}}replace(t,e,n){if([t,e]=b(this,t,e),n.lines=r&&e<=s){let a=o.replace(t-r,e-r,n),l=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>l>>6){let r=this.children.slice();return r[i]=a,new m(r,this.length-(e-t)+n.length)}return super.replace(r,s,a)}r=s+1}return super.replace(t,e,n)}sliceString(t,e=this.length,n="\n"){[t,e]=b(this,t,e);let i="";for(let r=0,o=0;rt&&r&&(i+=n),to&&(i+=s.sliceString(t-o,e-o,n)),o=a+1}return i}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof m))return 0;let n=0,[i,r,o,s]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=e,r+=e){if(i==o||r==s)return n;let a=this.children[i],l=t.children[r];if(a!=l)return n+a.scanIdentical(l,e);n+=a.length+1}}static from(t,e=t.reduce(((t,e)=>t+e.length+1),-1)){let n=0;for(let e of t)n+=e.lines;if(n<32){let n=[];for(let e of t)e.flatten(n);return new p(n,e)}let i=Math.max(32,n>>5),r=i<<1,o=i>>1,s=[],a=0,l=-1,c=[];function O(t){let e;if(t.lines>r&&t instanceof m)for(let e of t.children)O(e);else t.lines>o&&(a>o||!a)?(h(),s.push(t)):t instanceof p&&a&&(e=c[c.length-1])instanceof p&&t.lines+e.lines<=32?(a+=t.lines,l+=t.length+1,c[c.length-1]=new p(e.text.concat(t.text),e.length+1+t.length)):(a+t.lines>i&&h(),a+=t.lines,l+=t.length+1,c.push(t))}function h(){0!=a&&(s.push(1==c.length?c[0]:m.from(c,l)),l=-1,a=c.length=0)}for(let e of t)O(e);return h(),1==s.length?s[0]:new m(s,e)}}function g(t,e,n=0,i=1e9){for(let r=0,o=0,s=!0;o=n&&(l>i&&(a=a.slice(0,i-r)),r0?1:(t instanceof p?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,s=i instanceof p?i.text.length:i.children.length;if(o==(e>0?s:0)){if(0==n)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[n]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(i instanceof p){let r=i.text[o+(e<0?-1:0)];if(this.offsets[n]+=e,r.length>Math.max(0,t))return this.value=0==t?r:e>0?r.slice(t):r.slice(0,r.length-t),this;t-=r.length}else{let r=i.children[o+(e<0?-1:0)];t>r.length?(t-=r.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(e>0?1:(r instanceof p?r.text.length:r.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class ${constructor(t,e,n){this.value="",this.done=!1,this.cursor=new v(t,e>n?-1:1),this.pos=e>n?t.length:0,this.from=Math.min(e,n),this.to=Math.max(e,n)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;let{value:i}=this.cursor.next(t);return this.pos+=(i.length+t)*e,this.value=i.length<=n?i:e<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class Q{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:n,value:i}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(f.prototype[Symbol.iterator]=function(){return this.iter()},v.prototype[Symbol.iterator]=$.prototype[Symbol.iterator]=Q.prototype[Symbol.iterator]=function(){return this});class S{constructor(t,e,n,i){this.from=t,this.to=e,this.number=n,this.text=i}get length(){return this.to-this.from}}function b(t,e,n){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,n))]}function w(t,e,n=!0,i=!0){return a(t,e,n,i)}function x(t,e){let n=t.charCodeAt(e);if(!(i=n,i>=55296&&i<56320&&e+1!=t.length))return n;var i;let r=t.charCodeAt(e+1);return function(t){return t>=56320&&t<57344}(r)?r-56320+(n-55296<<10)+65536:n}function P(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function _(t){return t<65536?1:2}const k=/\r\n?|\n/;var T=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(T||(T={}));class R{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return r+(t-i);r+=s}else{if(n!=T.Simple&&l>=t&&(n==T.TrackDel&&it||n==T.TrackBefore&&it))return null;if(l>t||l==t&&e<0&&!s)return t==i||e<0?r:r+a;r+=a}i=l}if(t>i)throw new RangeError(`Position ${t} is out of range for changeset of length ${i}`);return r}touchesRange(t,e=t){for(let n=0,i=0;n=0&&i<=e&&r>=t)return!(ie)||"cover";i=r}return!1}toString(){let t="";for(let e=0;e=0?":"+i:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some((t=>"number"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new R(t)}static create(t){return new R(t)}}class X extends R{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return q(this,((e,n,i,r,o)=>t=t.replace(i,i+(n-e),o)),!1),t}mapDesc(t,e=!1){return E(this,t,e,!0)}invert(t){let e=this.sections.slice(),n=[];for(let i=0,r=0;i=0){e[i]=s,e[i+1]=o;let a=i>>1;for(;n.length0&&C(n,e,r.text),r.forward(t),s+=t}let l=t[o++];for(;s>1].toJSON()))}return t}static of(t,e,n){let i=[],r=[],o=0,s=null;function a(t=!1){if(!t&&!i.length)return;os||t<0||s>e)throw new RangeError(`Invalid change range ${t} to ${s} (in doc of length ${e})`);let O=c?"string"==typeof c?f.of(c.split(n||k)):c:f.empty,h=O.length;if(t==s&&0==h)return;to&&z(i,t-o,-1),z(i,s-t,h),C(r,i,O),o=s}}(t),a(!s),s}static empty(t){return new X(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],n=[];for(let i=0;ie&&"string"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)e.push(r[0],0);else{for(;n.length=0&&n<=0&&n==t[r+1]?t[r]+=e:r>=0&&0==e&&0==t[r]?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}function C(t,e,n){if(0==n.length)return;let i=e.length-2>>1;if(i>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],l=t.sections[s++];e(r,c,o,O,h),r=c,o=O}}}function E(t,e,n,i=!1){let r=[],o=i?[]:null,s=new Z(t),a=new Z(e);for(let t=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let t=Math.min(s.len,a.len);z(r,t,-1),s.forward(t),a.forward(t)}else if(a.ins>=0&&(s.ins<0||t==s.i||0==s.off&&(a.len=0&&t=0)){if(s.done&&a.done)return o?X.createSet(r,o):R.create(r);throw new Error("Mismatched change set lengths")}{let e=0,n=s.len;for(;n;)if(-1==a.ins){let t=Math.min(n,a.len);e+=t,n-=t,a.forward(t)}else{if(!(0==a.ins&&a.lene||s.ins>=0&&s.len>e)&&(t||i.length>n),o.forward2(e),s.forward(e)}}else z(i,0,s.ins,t),r&&C(r,i,s.text),s.next()}}class Z{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?f.empty:t[e]}textBit(t){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length&&!t?f.empty:e[n].slice(this.off,null==t?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class A{constructor(t,e,n){this.from=t,this.to=e,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let t=7&this.flags;return 7==t?null:t}get goalColumn(){let t=this.flags>>6;return 16777215==t?void 0:t}map(t,e=-1){let n,i;return this.empty?n=i=t.mapPos(this.from,e):(n=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new A(n,i,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return W.range(t,e);let n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return W.range(this.anchor,n)}eq(t,e=!1){return!(this.anchor!=t.anchor||this.head!=t.head||e&&this.empty&&this.assoc!=t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return W.range(t.anchor,t.head)}static create(t,e,n){return new A(t,e,n)}}class W{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:W.create(this.ranges.map((n=>n.map(t,e))),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let n=0;nt.toJSON())),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new W(t.ranges.map((t=>A.fromJSON(t))),t.main)}static single(t,e=t){return new W([W.range(t,e)],0)}static create(t,e=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;it?8:0)|r)}static normalized(t,e=0){let n=t[e];t.sort(((t,e)=>t.from-e.from)),e=t.indexOf(n);for(let n=1;ni.head?W.range(s,o):W.range(o,s))}}return new W(t,e)}}function Y(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let D=0;class U{constructor(t,e,n,i,r){this.combine=t,this.compareInput=e,this.compare=n,this.isStatic=i,this.id=D++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(t={}){return new U(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:M),!!t.static,t.enables)}of(t){return new j([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new j(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new j(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(n=>e(n.field(t))))}}function M(t,e){return t==e||t.length==e.length&&t.every(((t,n)=>t===e[n]))}class j{constructor(t,e,n,i){this.dependencies=t,this.facet=e,this.type=n,this.value=i,this.id=D++}dynamicSlot(t){var e;let n=this.value,i=this.facet.compareInput,r=this.id,o=t[r]>>1,s=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(e=t[n.id])&&void 0!==e?e:1)||c.push(t[n.id]);return{create:t=>(t.values[o]=n(t),1),update(t,e){if(a&&e.docChanged||l&&(e.docChanged||e.selection)||I(t,c)){let e=n(t);if(s?!L(e,t.values[o],i):!i(e,t.values[o]))return t.values[o]=e,1}return 0},reconfigure:(t,e)=>{let a,l=e.config.address[r];if(null!=l){let r=at(e,l);if(this.dependencies.every((n=>n instanceof U?e.facet(n)===t.facet(n):!(n instanceof B)||e.field(n,!1)==t.field(n,!1)))||(s?L(a=n(t),r,i):i(a=n(t),r)))return t.values[o]=r,0}else a=n(t);return t.values[o]=a,1}}}}function L(t,e,n){if(t.length!=e.length)return!1;for(let i=0;it[e.id])),r=n.map((t=>t.type)),o=i.filter((t=>!(1&t))),s=t[e.id]>>1;function a(t){let n=[];for(let e=0;et===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(G).find((t=>t.field==this));return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:t=>(t.values[e]=this.create(t),1),update:(t,n)=>{let i=t.values[e],r=this.updateF(i,n);return this.compareF(i,r)?0:(t.values[e]=r,1)},reconfigure:(t,n)=>{let i,r=t.facet(G),o=n.facet(G);return(i=r.find((t=>t.field==this)))&&i!=o.find((t=>t.field==this))?(t.values[e]=i.create(t),1):null!=n.config.address[this.id]?(t.values[e]=n.field(this),0):(t.values[e]=this.create(t),1)}}}init(t){return[this,G.of({field:this,create:t})]}get extension(){return this}}const F=4,H=3,K=2,J=1;function tt(t){return e=>new nt(e,t)}const et={highest:tt(0),high:tt(J),default:tt(K),low:tt(H),lowest:tt(F)};class nt{constructor(t,e){this.inner=t,this.prec=e}}class it{of(t){return new rt(this,t)}reconfigure(t){return it.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class rt{constructor(t,e){this.compartment=t,this.inner=e}}class ot{constructor(t,e,n,i,r,o){for(this.base=t,this.compartments=e,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,n){let i=[],r=Object.create(null),o=new Map;for(let n of function(t,e,n){let i=[[],[],[],[],[]],r=new Map;function o(t,s){let a=r.get(t);if(null!=a){if(a<=s)return;let e=i[a].indexOf(t);e>-1&&i[a].splice(e,1),t instanceof rt&&n.delete(t.compartment)}if(r.set(t,s),Array.isArray(t))for(let e of t)o(e,s);else if(t instanceof rt){if(n.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=e.get(t.compartment)||t.inner;n.set(t.compartment,i),o(i,s)}else if(t instanceof nt)o(t.inner,t.prec);else if(t instanceof B)i[s].push(t),t.provides&&o(t.provides,s);else if(t instanceof j)i[s].push(t),t.facet.extensions&&o(t.facet.extensions,K);else{let e=t.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${t}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(e,s)}}return o(t,K),i.reduce(((t,e)=>t.concat(e)))}(t,e,o))n instanceof B?i.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let s=Object.create(null),a=[],l=[];for(let t of i)s[t.id]=l.length<<1,l.push((e=>t.slot(e)));let c=null==n?void 0:n.config.facets;for(let t in r){let e=r[t],i=e[0].facet,o=c&&c[t]||[];if(e.every((t=>0==t.type)))if(s[i.id]=a.length<<1|1,M(o,e))a.push(n.facet(i));else{let t=i.combine(e.map((t=>t.value)));a.push(n&&i.compare(t,n.facet(i))?n.facet(i):t)}else{for(let t of e)0==t.type?(s[t.id]=a.length<<1|1,a.push(t.value)):(s[t.id]=l.length<<1,l.push((e=>t.dynamicSlot(e))));s[i.id]=l.length<<1,l.push((t=>N(t,i,e)))}}let O=l.map((t=>t(s)));return new ot(t,o,O,s,a,r)}}function st(t,e){if(1&e)return 2;let n=e>>1,i=t.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;t.status[n]=4;let r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function at(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const lt=U.define(),ct=U.define({combine:t=>t.some((t=>t)),static:!0}),Ot=U.define({combine:t=>t.length?t[0]:void 0,static:!0}),ht=U.define(),ut=U.define(),dt=U.define(),ft=U.define({combine:t=>!!t.length&&t[0]});class pt{constructor(t,e){this.type=t,this.value=e}static define(){return new mt}}class mt{of(t){return new pt(this,t)}}class gt{constructor(t){this.map=t}of(t){return new yt(this,t)}}class yt{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new yt(this.type,e)}is(t){return this.type==t}static define(t={}){return new gt(t.map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let n=[];for(let i of t){let t=i.map(e);t&&n.push(t)}return n}}yt.reconfigure=yt.define(),yt.appendConfig=yt.define();class vt{constructor(t,e,n,i,r,o){this.startState=t,this.changes=e,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n&&Y(n,e.newLength),r.some((t=>t.type==vt.time))||(this.annotations=r.concat(vt.time.of(Date.now())))}static create(t,e,n,i,r,o){return new vt(t,e,n,i,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(vt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function $t(t,e){let n=[];for(let i=0,r=0;;){let o,s;if(i=t[i]))o=t[i++],s=t[i++];else{if(!(r=0;r--){let o=n[r](t);o&&Object.keys(o).length&&(i=Qt(i,St(e,o,t.changes.newLength),!0))}return i==t?t:vt.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(t){let e=t.startState,n=!0;for(let i of e.facet(ht)){let e=i(t);if(!1===e){n=!1;break}Array.isArray(e)&&(n=!0===n?e:$t(n,e))}if(!0!==n){let i,r;if(!1===n)r=t.changes.invertedDesc,i=X.empty(e.doc.length);else{let e=t.changes.filter(n);i=e.changes,r=e.filtered.mapDesc(e.changes).invertedDesc}t=vt.create(e,i,t.selection&&t.selection.map(r),yt.mapEffects(t.effects,r),t.annotations,t.scrollIntoView)}let i=e.facet(ut);for(let n=i.length-1;n>=0;n--){let r=i[n](t);t=r instanceof vt?r:Array.isArray(r)&&1==r.length&&r[0]instanceof vt?r[0]:bt(e,xt(r),!1)}return t}(r):r)}vt.time=pt.define(),vt.userEvent=pt.define(),vt.addToHistory=pt.define(),vt.remote=pt.define();const wt=[];function xt(t){return null==t?wt:Array.isArray(t)?t:[t]}var Pt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Pt||(Pt={}));const _t=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let kt;try{kt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function Tt(t){return e=>{if(!/\S/.test(e))return Pt.Space;if(function(t){if(kt)return kt.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||_t.test(n)))return!0}return!1}(e))return Pt.Word;for(let n=0;n-1)return Pt.Word;return Pt.Other}}class Rt{constructor(t,e,n,i,r,o){this.config=t,this.doc=e,this.selection=n,this.values=i,this.status=t.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let t=0;tr.set(e,t))),n=null),r.set(e.value.compartment,e.value.extension)):e.is(yt.reconfigure)?(n=null,i=e.value):e.is(yt.appendConfig)&&(n=null,i=xt(i).concat(e.value));if(n)e=t.startState.values.slice();else{n=ot.resolve(i,r,this),e=new Rt(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values}let o=t.startState.facet(ct)?t.newSelection:t.newSelection.asSingle();new Rt(n,t.newDoc,o,e,((e,n)=>n.update(e,t)),t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t},range:W.cursor(e.from+t.length)})))}changeByRange(t){let e=this.selection,n=t(e.ranges[0]),i=this.changes(n.changes),r=[n.range],o=xt(n.effects);for(let n=1;nr.spec.fromJSON(o,t))))}return Rt.create({doc:t.doc,selection:W.fromJSON(t.selection),extensions:e.extensions?i.concat([e.extensions]):i})}static create(t={}){let e=ot.resolve(t.extensions||[],new Map),n=t.doc instanceof f?t.doc:f.of((t.doc||"").split(e.staticFacet(Rt.lineSeparator)||k)),i=t.selection?t.selection instanceof W?t.selection:W.single(t.selection.anchor,t.selection.head):W.single(0);return Y(i,n.length),e.staticFacet(ct)||(i=i.asSingle()),new Rt(e,n,i,e.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(Rt.tabSize)}get lineBreak(){return this.facet(Rt.lineSeparator)||"\n"}get readOnly(){return this.facet(ft)}phrase(t,...e){for(let e of this.facet(Rt.phrases))if(Object.prototype.hasOwnProperty.call(e,t)){t=e[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,((t,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>e.length?t:e[i-1]}))),t}languageDataAt(t,e,n=-1){let i=[];for(let r of this.facet(lt))for(let o of r(this,e,n))Object.prototype.hasOwnProperty.call(o,t)&&i.push(o[t]);return i}charCategorizer(t){return Tt(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:e,from:n,length:i}=this.doc.lineAt(t),r=this.charCategorizer(t),o=t-n,s=t-n;for(;o>0;){let t=w(e,o,!1);if(r(e.slice(t,o))!=Pt.Word)break;o=t}for(;st.length?t[0]:4}),Rt.lineSeparator=Ot,Rt.readOnly=ft,Rt.phrases=U.define({compare(t,e){let n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every((n=>t[n]==e[n]))}}),Rt.languageData=lt,Rt.changeFilter=ht,Rt.transactionFilter=ut,Rt.transactionExtender=dt,it.reconfigure=yt.define();class zt{eq(t){return this==t}range(t,e=t){return Ct.create(t,e,this)}}zt.prototype.startSide=zt.prototype.endSide=0,zt.prototype.point=!1,zt.prototype.mapMode=T.TrackDel;class Ct{constructor(t,e,n){this.from=t,this.to=e,this.value=n}static create(t,e,n){return new Ct(t,e,n)}}function qt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Et{constructor(t,e,n,i){this.from=t,this.to=e,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(t,e,n,i=0){let r=n?this.to:this.from;for(let o=i,s=r.length;;){if(o==s)return o;let i=o+s>>1,a=r[i]-t||(n?this.value[i].endSide:this.value[i].startSide)-e;if(i==o)return a>=0?o:s;a>=0?s=i:o=i+1}}between(t,e,n,i){for(let r=this.findIndex(e,-1e9,!0),o=this.findIndex(n,1e9,!1,r);rc||l==c&&O.startSide>0&&O.endSide<=0)continue;(c-l||O.endSide-O.startSide)<0||(o<0&&(o=l),O.point&&(s=Math.max(s,c-l)),n.push(O),i.push(l-o),r.push(c-o))}return{mapped:n.length?new Et(i,r,n,s):null,pos:o}}}class Vt{constructor(t,e,n,i){this.chunkPos=t,this.chunk=e,this.nextLayer=n,this.maxPoint=i}static create(t,e,n,i){return new Vt(t,e,n,i)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=t,o=t.filter;if(0==e.length&&!o)return this;if(n&&(e=e.slice().sort(qt)),this.isEmpty)return e.length?Vt.of(e):this;let s=new Wt(this,null,-1).goto(0),a=0,l=[],c=new Zt;for(;s.value||a=0){let t=e[a++];c.addInner(t.from,t.to,t.value)||l.push(t)}else 1==s.rangeIndex&&s.chunkIndexthis.chunkEnd(s.chunkIndex)||rs.to||r=r&&t<=r+o.length&&!1===o.between(r,t-r,e-r,n))return}this.nextLayer.between(t,e,n)}}iter(t=0){return Yt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Yt.from(t).goto(e)}static compare(t,e,n,i,r=-1){let o=t.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r)),s=e.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r)),a=At(o,s,n),l=new Ut(o,a,r),c=new Ut(s,a,r);n.iterGaps(((t,e,n)=>Mt(l,t,c,e,n,i))),n.empty&&0==n.length&&Mt(l,0,c,0,0,i)}static eq(t,e,n=0,i){null==i&&(i=999999999);let r=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0)),o=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0));if(r.length!=o.length)return!1;if(!r.length)return!0;let s=At(r,o),a=new Ut(r,s,0).goto(n),l=new Ut(o,s,0).goto(n);for(;;){if(a.to!=l.to||!jt(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>i)return!0;a.next(),l.next()}}static spans(t,e,n,i,r=-1){let o=new Ut(t,null,r).goto(e),s=e,a=o.openStart;for(;;){let t=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),r=o.pointFroms&&(i.span(s,t,o.active,a),a=o.openEnd(t));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(t,e=!1){let n=new Zt;for(let i of t instanceof Ct?[t]:e?function(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(qt);e=i}return t}(t):t)n.add(i.from,i.to,i.value);return n.finish()}static join(t){if(!t.length)return Vt.empty;let e=t[t.length-1];for(let n=t.length-2;n>=0;n--)for(let i=t[n];i!=Vt.empty;i=i.nextLayer)e=new Vt(i.chunkPos,i.chunk,e,Math.max(i.maxPoint,e.maxPoint));return e}}Vt.empty=new Vt([],[],null,-1),Vt.empty.nextLayer=Vt.empty;class Zt{finishChunk(t){this.chunks.push(new Et(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,n){this.addInner(t,e,n)||(this.nextLayer||(this.nextLayer=new Zt)).add(t,e,n)}addInner(t,e,n){let i=t-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}finish(){return this.finishInner(Vt.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=Vt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function At(t,e,n){let i=new Map;for(let e of t)for(let t=0;t=this.minPoint)break}}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&i.push(new Wt(o,e,n,r));return 1==i.length?i[0]:new Yt(i)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let n of this.heap)n.goto(t,e);for(let t=this.heap.length>>1;t>=0;t--)Dt(this.heap,t);return this.next(),this}forward(t,e){for(let n of this.heap)n.forward(t,e);for(let t=this.heap.length>>1;t>=0;t--)Dt(this.heap,t);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Dt(this.heap,0)}}}function Dt(t,e){for(let n=t[e];;){let i=1+(e<<1);if(i>=t.length)break;let r=t[i];if(i+1=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}class Ut{constructor(t,e,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Yt.from(t,e,n)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Lt(this.active,t),Lt(this.activeTo,t),Lt(this.activeRank,t),this.minActive=Nt(this.active,this.activeTo)}addActive(t){let e=0,{value:n,to:i,rank:r}=this.cursor;for(;e0;)e++;It(this.active,e,n),It(this.activeTo,e,i),It(this.activeRank,e,r),t&&It(t,e,this.cursor.from),this.minActive=Nt(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Lt(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let t=this.cursor.value;if(t.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from=0&&n[e]=0&&!(this.activeRank[n]t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}openEnd(t){let e=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}function Mt(t,e,n,i,r,o){t.goto(e),n.goto(i);let s=i+r,a=i,l=i-e;for(;;){let e=t.to+l-n.to,i=e||t.endSide-n.endSide,r=i<0?t.to+l:n.to,c=Math.min(r,s);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&jt(t.activeForPoint(t.to),n.activeForPoint(n.to))||o.comparePoint(a,c,t.point,n.point):c>a&&!jt(t.active,n.active)&&o.compareRange(a,c,t.active,n.active),r>s)break;(e||t.openEnd!=n.openEnd)&&o.boundChange&&o.boundChange(r),a=r,i<=0&&t.next(),i>=0&&n.next()}}function jt(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;n--)t[n+1]=t[n];t[e]=n}function Nt(t,e){let n=-1,i=1e9;for(let r=0;r=e)return i;if(i==t.length)break;r+=9==t.charCodeAt(i)?n-r%n:1,i=w(t,i)}return!0===i?-1:t.length}const Ft="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Ht="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Kt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class Jt{constructor(t,e){this.rules=[];let{finish:n}=e||{};function i(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function r(t,e,o,s){let a=[],l=/^@(\w+)\b/.exec(t[0]),c=l&&"keyframes"==l[1];if(l&&null==e)return o.push(t[0]+";");for(let n in e){let s=e[n];if(/&/.test(n))r(n.split(/,\s*/).map((e=>t.map((t=>e.replace(/&/,t))))).reduce(((t,e)=>t.concat(e))),s,o);else if(s&&"object"==typeof s){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");r(i(n),s,a,c)}else null!=s&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+s+";")}(a.length||c)&&o.push((!n||l||s?t:t.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let e in t)r(i(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=Kt[Ft]||1;return Kt[Ft]=t+1,"ͼ"+t.toString(36)}static mount(t,e,n){let i=t[Ht],r=n&&n.nonce;i?r&&i.setNonce(r):i=new ee(t,r),i.mount(Array.isArray(e)?e:[e],t)}}let te=new Map;class ee{constructor(t,e){let n=t.ownerDocument||t,i=n.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let e=te.get(n);if(e)return t[Ht]=e;this.sheet=new i.CSSStyleSheet,te.set(n,this)}else this.styleTag=n.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Ht]=this}mount(t,e){let n=this.sheet,i=0,r=0;for(let e=0;e-1&&(this.modules.splice(s,1),r--,s=-1),-1==s){if(this.modules.splice(r++,0,o),n)for(let t=0;t",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},re="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),oe="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),se=0;se<10;se++)ne[48+se]=ne[96+se]=String(se);for(se=1;se<=24;se++)ne[se+111]="F"+se;for(se=65;se<=90;se++)ne[se]=String.fromCharCode(se+32),ie[se]=String.fromCharCode(se);for(var ae in ne)ie.hasOwnProperty(ae)||(ie[ae]=ne[ae]);function le(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function ce(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function Oe(t,e){if(!e.anchorNode)return!1;try{return ce(t,e.anchorNode)}catch(t){return!1}}function he(t){return 3==t.nodeType?we(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function ue(t,e,n,i){return!!n&&(pe(t,e,n,i,-1)||pe(t,e,n,i,1))}function de(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function fe(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function pe(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:me(t))){if("DIV"==t.nodeName)return!1;let n=t.parentNode;if(!n||1!=n.nodeType)return!1;e=de(t)+(r<0?0:1),t=n}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=r<0?me(t):0}}}function me(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function ge(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function ye(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function ve(t,e){let n=e.width/t.offsetWidth,i=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-t.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}class $e{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:n}=t;this.set(e,Math.min(t.anchorOffset,e?me(e):0),n,Math.min(t.focusOffset,n?me(n):0))}set(t,e,n,i){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=i}}let Qe,Se=null;function be(t){if(t.setActive)return t.setActive();if(Se)return t.focus(Se);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(null==Se?{get preventScroll(){return Se={preventScroll:!0},!0}}:void 0),!Se){Se=!1;for(let t=0;tMath.max(1,t.scrollHeight-t.clientHeight-4)}function ke(t,e){for(let n=t,i=e;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=me(n)}else{if(!n.parentNode||fe(n))return null;i=de(n),n=n.parentNode}}}function Te(t,e){for(let n=t,i=e;;){if(3==n.nodeType&&ie)return n.domBoundsAround(t,e,l);if(O>=t&&-1==i&&(i=a,r=l),l>e&&n.dom.parentNode==this.dom){o=a,s=c;break}c=O,l=O+n.breakAfter}return{from:r,to:s<0?n+this.length:s,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,n=Xe){this.markDirty();for(let i=t;ithis.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Ee(t,e,n,i,r,o,s,a,l){let{children:c}=t,O=c.length?c[e]:null,h=o.length?o[o.length-1]:null,u=h?h.breakAfter:s;if(!(e==i&&O&&!s&&!u&&o.length<2&&O.merge(n,r,o.length?h:null,0==n,a,l))){if(i0&&(!s&&o.length&&O.merge(n,O.length,o[0],!1,a,0)?O.breakAfter=o.shift().breakAfter:(n2);var Ge={mac:Ne||/Mac/.test(Ze.platform),windows:/Win/.test(Ze.platform),linux:/Linux|X11/.test(Ze.platform),ie:Ue,ie_version:Ye?Ae.documentMode||6:De?+De[1]:We?+We[1]:0,gecko:Me,gecko_version:Me?+(/Firefox\/(\d+)/.exec(Ze.userAgent)||[0,0])[1]:0,chrome:!!je,chrome_version:je?+je[1]:0,ios:Ne,android:/Android\b/.test(Ze.userAgent),webkit:Le,safari:Ie,webkit_version:Le?+(/\bAppleWebKit\/(\d+)/.exec(Ze.userAgent)||[0,0])[1]:0,tabSize:null!=Ae.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Be extends ze{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,n){return!(8&this.flags||n&&(!(n instanceof Be)||this.length-(e-t)+n.length>256||8&n.flags))&&(this.text=this.text.slice(0,t)+(n?n.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new Be(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new Re(this.dom,t)}domBoundsAround(t,e,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return function(t,e,n){let i=t.nodeValue.length;e>i&&(e=i);let r=e,o=e,s=0;0==e&&n<0||e==i&&n>=0?Ge.chrome||Ge.gecko||(e?(r--,s=1):o=0)?0:a.length-1];Ge.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(a,(t=>t.width))||l);return s?ge(l,s<0):l||null}(this.dom,t,e)}}class Fe extends ze{constructor(t,e=[],n=0){super(),this.mark=t,this.children=e,this.length=n;for(let t of e)t.setParent(this)}setAttrs(t){if(Pe(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!(8&(this.flags|t.flags))}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,n,i,r,o){return(!n||!(!(n instanceof Fe&&n.mark.eq(this.mark))||t&&r<=0||et&&e.push(n=t&&(i=r),n=s,r++}let o=this.length-t;return this.length=t,i>-1&&(this.children.length=i,this.markDirty()),new Fe(this.mark,e,o)}domAtPos(t){return Je(this,t)}coordsAt(t,e){return en(this,t,e)}}class He extends ze{static create(t,e,n){return new He(t,e,n)}constructor(t,e,n){super(),this.widget=t,this.length=e,this.side=n,this.prevWidget=null}split(t){let e=He.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,e,n,i,r,o){return!(n&&(!(n instanceof He&&this.widget.compare(n.widget))||t>0&&r<=0||e0)?Re.before(this.dom):Re.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let n=this.widget.coordsAt(this.dom,t,e);if(n)return n;let i=this.dom.getClientRects(),r=null;if(!i.length)return null;let o=this.side?this.side<0:t>0;for(let e=o?i.length-1:0;r=i[e],!(t>0?0==e:e==i.length-1||r.top0?Re.before(this.dom):Re.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return f.empty}get isHidden(){return!0}}function Je(t,e){let n=t.dom,{children:i}=t,r=0;for(let t=0;rt&&e0;t--){let e=i[t-1];if(e.dom.parentNode==n)return e.domAtPos(e.length)}for(let t=r;t0&&e instanceof Fe&&r.length&&(i=r[r.length-1])instanceof Fe&&i.mark.eq(e.mark)?tn(i,e.children[0],n-1):(r.push(e),e.setParent(t)),t.length+=e.length}function en(t,e,n){let i=null,r=-1,o=null,s=-1;!function t(e,a){for(let l=0,c=0;l=a&&(O.children.length?t(O,a-c):(!o||o.isHidden&&(n>0||nn(o,O)))&&(h>a||c==h&&O.getSide()>0)?(o=O,s=a-c):(c-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let o of i)if(o!=n&&(-1==r.indexOf(o)||t[o]!==e[o]))return!1;return!0}function an(t,e,n){let i=!1;if(e)for(let r in e)n&&r in n||(i=!0,"style"==r?t.style.cssText="":t.removeAttribute(r));if(n)for(let r in n)e&&e[r]==n[r]||(i=!0,"style"==r?t.style.cssText=n[r]:t.setAttribute(r,n[r]));return i}function ln(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:e>0?1e8:-1e8,new fn(t,e,e,n,t.widget||null,!1)}static replace(t){let e,n,i=!!t.block;if(t.isBlockGap)e=-5e8,n=4e8;else{let{start:r,end:o}=pn(t,i);e=(r?i?-3e8:-1:5e8)-1,n=1+(o?i?2e8:1:-6e8)}return new fn(t,e,n,i,t.widget||null,!0)}static line(t){return new dn(t)}static set(t,e=!1){return Vt.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}hn.none=Vt.empty;class un extends hn{constructor(t){let{start:e,end:n}=pn(t);super(e?-1:5e8,n?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,n;return this==t||t instanceof un&&this.tagName==t.tagName&&(this.class||(null===(e=this.attrs)||void 0===e?void 0:e.class))==(t.class||(null===(n=t.attrs)||void 0===n?void 0:n.class))&&sn(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}un.prototype.point=!1;class dn extends hn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof dn&&this.spec.class==t.spec.class&&sn(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}dn.prototype.mapMode=T.TrackBefore,dn.prototype.point=!0;class fn extends hn{constructor(t,e,n,i,r,o){super(e,n,r,t),this.block=i,this.isReplace=o,this.mapMode=i?e<=0?T.TrackBefore:T.TrackAfter:T.TrackDel}get type(){return this.startSide!=this.endSide?On.WidgetRange:this.startSide<=0?On.WidgetBefore:On.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof fn&&(e=this.widget,n=t.widget,e==n||!!(e&&n&&e.compare(n)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,n}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function pn(t,e=!1){let{inclusiveStart:n,inclusiveEnd:i}=t;return null==n&&(n=t.inclusive),null==i&&(i=t.inclusive),{start:null!=n?n:e,end:null!=i?i:e}}function mn(t,e,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=t?n[r]=Math.max(n[r],e):n.push(t,e)}fn.prototype.point=!0;class gn extends ze{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,n,i,r,o){if(n){if(!(n instanceof gn))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),Ve(this,t,e,n?n.children.slice():[],r,o),!0}split(t){let e=new gn;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i:n,off:i}=this.childPos(t);i&&(e.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let t=n;t0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){sn(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){tn(this,t,e)}addLineDeco(t){let e=t.spec.attributes,n=t.spec.class;e&&(this.attrs=rn(e,this.attrs||{})),n&&(this.attrs=rn({class:n},this.attrs||{}))}domAtPos(t){return Je(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var n;this.dom?4&this.flags&&(Pe(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(an(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let i=this.dom.lastChild;for(;i&&ze.get(i)instanceof Fe;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=ze.get(i))||void 0===n?void 0:n.isEditable)||Ge.ios&&this.children.some((t=>t instanceof Be))))){let t=document.createElement("BR");t.cmIgnore=!0,this.dom.appendChild(t)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t,e=0;for(let n of this.children){if(!(n instanceof Be)||/[^ -~]/.test(n.text))return null;let i=he(n.dom);if(1!=i.length)return null;e+=i[0].width,t=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let n=en(this,t,e);if(!this.children.length&&n&&this.parent){let{heightOracle:t}=this.parent.view.viewState,e=n.bottom-n.top;if(Math.abs(e-t.lineHeight)<2&&t.textHeight=e){if(r instanceof gn)return r;if(o>e)break}i=o+r.breakAfter}return null}}class yn extends ze{constructor(t,e,n){super(),this.widget=t,this.length=e,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(t,e,n,i,r,o){return!(n&&(!(n instanceof yn&&this.widget.compare(n.widget))||t>0&&r<=0||e0)}}class vn extends cn{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class $n{constructor(t,e,n,i){this.doc=t,this.pos=e,this.end=n,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof yn&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new gn),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Qn(new Ke(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof yn||this.getLine()}buildText(t,e,n){for(;t>0;){if(this.textOff==this.text.length){let{value:e,lineBreak:n,done:i}=this.cursor.next(this.skip);if(this.skip=0,i)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=e,this.textOff=0}let i=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-n)),this.getLine().append(Qn(new Be(this.text.slice(this.textOff,this.textOff+i)),e),n),this.atCursorPos=!0,this.textOff+=i,t-=i,n=0}}span(t,e,n,i){this.buildText(e-t,n,i),this.pos=e,this.openStart<0&&(this.openStart=i)}point(t,e,n,i,r,o){if(this.disallowBlockEffectsFor[o]&&n instanceof fn){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let s=e-t;if(n instanceof fn)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new yn(n.widget||Sn.block,s,n));else{let o=He.create(n.widget||Sn.inline,s,s?0:n.startSide),a=this.atCursorPos&&!o.isEditable&&r<=i.length&&(t0),l=!o.isEditable&&(ti.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||a||o.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),a&&(c.append(Qn(new Ke(1),i),r),r=i.length+Math.max(0,r-i.length)),c.append(Qn(o,i),r),this.atCursorPos=l,this.pendingBuffer=l?ti.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}static build(t,e,n,i,r){let o=new $n(t,e,n,r);return o.openEnd=Vt.spans(i,e,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Qn(t,e){for(let n of e)t=new Fe(n,[t],t.length);return t}class Sn extends cn{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Sn.inline=new Sn("span"),Sn.block=new Sn("div");var bn=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(bn||(bn={}));const wn=bn.LTR,xn=bn.RTL;function Pn(t){let e=[];for(let n=0;n=e){if(s.level==n)return o;(r<0||(0!=i?i<0?s.frome:t[r].level>s.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function qn(t,e){if(t.length!=e.length)return!1;for(let n=0;nl&&s.push(new Cn(l,f.from,u)),Zn(t,f.direction==wn!=!(u%2)?i+1:i,r,f.inner,f.from,f.to,s),l=f.to}d=f.to}else{if(d==n||(e?En[d]!=a:En[d]==a))break;d++}h?Vn(t,l,d,i+1,r,h,s):le;){let n=!0,O=!1;if(!c||l>o[c-1].to){let t=En[l-1];t!=a&&(n=!1,O=16==t)}let h=n||1!=a?null:[],u=n?i:i+1,d=l;t:for(;;)if(c&&d==o[c-1].to){if(O)break t;let f=o[--c];if(!n)for(let t=f.from,n=c;;){if(t==e)break t;if(!n||o[n-1].to!=t){if(En[t-1]==a)break t;break}t=o[--n].from}if(h)h.push(f);else{f.to=0;t-=3)if(Rn[t+1]==-n){let e=Rn[t+2],n=2&e?r:4&e?1&e?o:r:0;n&&(En[s]=En[Rn[t]]=n),a=t;break}}else{if(189==Rn.length)break;Rn[a++]=s,Rn[a++]=e,Rn[a++]=l}else if(2==(i=En[s])||1==i){let t=i==r;l=t?0:1;for(let e=a-3;e>=0;e-=3){let n=Rn[e+2];if(2&n)break;if(t)Rn[e+2]|=2;else{if(4&n)break;Rn[e+2]|=4}}}}}(t,r,o,i,a),function(t,e,n,i){for(let r=0,o=i;r<=n.length;r++){let s=r?n[r-1].to:t,a=rl;)e==o&&(e=n[--i].from,o=i?n[i-1].to:t),En[--e]=O;l=s}else o=s,l++}}}(r,o,i,a),Vn(t,r,o,e,n,i,s)}function An(t,e,n){if(!t)return[new Cn(0,0,e==xn?1:0)];if(e==wn&&!n.length&&!zn.test(t))return Wn(t.length);if(n.length)for(;t.length>En.length;)En[En.length]=256;let i=[],r=e==wn?0:1;return Zn(t,r,r,n,0,t.length,i),i}function Wn(t){return[new Cn(0,t,0)]}let Yn="";function Dn(t,e,n,i,r){var o;let s=i.head-t.from,a=Cn.find(e,s,null!==(o=i.bidiLevel)&&void 0!==o?o:-1,i.assoc),l=e[a],c=l.side(r,n);if(s==c){let t=a+=r?1:-1;if(t<0||t>=e.length)return null;l=e[a=t],s=l.side(!r,n),c=l.side(r,n)}let O=w(t.text,s,l.forward(r,n));(Ol.to)&&(O=c),Yn=t.text.slice(Math.min(s,O),Math.max(s,O));let h=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];return h&&O==c&&h.level+(r?0:1)t.some((t=>t))}),Jn=U.define({combine:t=>t.some((t=>t))}),ti=U.define();class ei{constructor(t,e="nearest",n="nearest",i=5,r=5,o=!1){this.range=t,this.y=e,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=o}map(t){return t.empty?this:new ei(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new ei(W.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ni=yt.define({map:(t,e)=>t.map(e)}),ii=yt.define();function ri(t,e,n){let i=t.facet(In);i.length?i[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}const oi=U.define({combine:t=>!t.length||t[0]});let si=0;const ai=U.define();class li{constructor(t,e,n,i,r){this.id=t,this.create=e,this.domEventHandlers=n,this.domEventObservers=i,this.extension=r(this)}static define(t,e){const{eventHandlers:n,eventObservers:i,provide:r,decorations:o}=e||{};return new li(si++,t,n,i,(t=>{let e=[ai.of(t)];return o&&e.push(ui.of((e=>{let n=e.plugin(t);return n?o(n):hn.none}))),r&&e.push(r(t)),e}))}static fromClass(t,e){return li.define((e=>new t(e)),e)}}class ci{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(ri(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){ri(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){ri(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Oi=U.define(),hi=U.define(),ui=U.define(),di=U.define(),fi=U.define(),pi=U.define();function mi(t,e){let n=t.state.facet(pi);if(!n.length)return n;let i=n.map((e=>e instanceof Function?e(t):e)),r=[];return Vt.spans(i,e.from,e.to,{point(){},span(t,n,i,o){let s=t-e.from,a=n-e.from,l=r;for(let t=i.length-1;t>=0;t--,o--){let n,r=i[t].spec.bidiIsolate;if(null==r&&(r=Un(e.text,s,a)),o>0&&l.length&&(n=l[l.length-1]).to==s&&n.direction==r)n.to=a,l=n.inner;else{let t={from:s,to:a,direction:r,inner:[]};l.push(t),l=t.inner}}}}),r}const gi=U.define();function yi(t){let e=0,n=0,i=0,r=0;for(let o of t.state.facet(gi)){let s=o(t);s&&(null!=s.left&&(e=Math.max(e,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(i=Math.max(i,s.top)),null!=s.bottom&&(r=Math.max(r,s.bottom)))}return{left:e,right:n,top:i,bottom:r}}const vi=U.define();class $i{constructor(t,e,n,i){this.fromA=t,this.toA=e,this.fromB=n,this.toB=i}join(t){return new $i(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,n=this;for(;e>0;e--){let i=t[e-1];if(!(i.fromA>n.toA)){if(i.toAc)break;r+=2}if(!a)return n;new $i(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),o=a.toA,s=a.toB}}}class Qi{constructor(t,e,n){this.view=t,this.state=e,this.transactions=n,this.flags=0,this.startState=t.state,this.changes=X.empty(this.startState.doc.length);for(let t of n)this.changes=this.changes.compose(t.changes);let i=[];this.changes.iterChangedRanges(((t,e,n,r)=>i.push(new $i(t,e,n,r)))),this.changedRanges=i}static create(t,e,n){return new Qi(t,e,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((t=>t.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}class Si extends ze{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=hn.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new gn],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new $i(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let n=t.changedRanges;this.minWidth>0&&n.length&&(n.every((({fromA:t,toA:e})=>ethis.minWidthTo))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?i=this.domChanged.newSel.head:function(t,e){let n=!1;e&&t.iterChangedRanges(((t,i)=>{te.from&&(n=!0)}));return n}(t.changes,this.hasComposition)||t.selectionSet||(i=t.state.selection.main.head));let r=i>-1?function(t,e,n){let i=bi(t,n);if(!i)return null;let{node:r,from:o,to:s}=i,a=r.nodeValue;if(/[\n\r]/.test(a))return null;if(t.state.doc.sliceString(i.from,i.to)!=a)return null;let l=e.invertedDesc,c=new $i(l.mapPos(o),l.mapPos(s),o,s),O=[];for(let e=r.parentNode;;e=e.parentNode){let n=ze.get(e);if(n instanceof Fe)O.push({node:e,deco:n.mark});else{if(n instanceof gn||"DIV"==e.nodeName&&e.parentNode==t.contentDOM)return{range:c,text:r,marks:O,line:e};if(e==t.contentDOM)return null;O.push({node:e,deco:new un({inclusive:!0,attributes:ln(e),tagName:e.tagName.toLowerCase()})})}}}(this.view,t.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:e,to:i}=this.hasComposition;n=new $i(e,i,t.changes.mapPos(e,-1),t.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Ge.ie||Ge.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=function(t,e,n){let i=new wi;return Vt.compare(t,e,n,i),i.changes}(this.decorations,this.updateDeco(),t.changes);return n=$i.extendWithRanges(n,o),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,n);let{observer:i}=this.view;i.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=Ge.chrome||Ge.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.flags&=-8,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((t=>t.flags&=-9));let r=[];if(this.view.viewport.from||this.view.viewport.to=0?i[t]:null;if(!e)break;let o,s,a,l,{fromA:c,toA:O,fromB:h,toB:u}=e;if(n&&n.range.fromBh){let t=$n.build(this.view.state.doc,h,n.range.fromB,this.decorations,this.dynamicDecorationMap),e=$n.build(this.view.state.doc,n.range.toB,u,this.decorations,this.dynamicDecorationMap);s=t.breakAtStart,a=t.openStart,l=e.openEnd;let i=this.compositionView(n);e.breakAtStart?i.breakAfter=1:e.content.length&&i.merge(i.length,i.length,e.content[0],!1,e.openStart,0)&&(i.breakAfter=e.content[0].breakAfter,e.content.shift()),t.content.length&&i.merge(0,0,t.content[t.content.length-1],!0,0,t.openEnd)&&t.content.pop(),o=t.content.concat(i).concat(e.content)}else({content:o,breakAtStart:s,openStart:a,openEnd:l}=$n.build(this.view.state.doc,h,u,this.decorations,this.dynamicDecorationMap));let{i:d,off:f}=r.findPos(O,1),{i:p,off:m}=r.findPos(c,-1);Ee(this,p,m,d,f,o,s,a,l)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let t of e.effects)t.is(ii)&&(this.editContextFormatting=t.value)}compositionView(t){let e=new Be(t.text.nodeValue);e.flags|=8;for(let{deco:n}of t.marks)e=new Fe(n,[e],e.length);let n=new gn;return n.append(e,0),n}fixCompositionDOM(t){let e=(t,e)=>{e.flags|=8|(e.children.some((t=>7&t.flags))?1:0),this.markedForComposition.add(e);let n=ze.get(t);n&&n!=e&&(n.dom=null),e.setDOM(t)},n=this.childPos(t.range.fromB,1),i=this.children[n.i];e(t.line,i);for(let r=t.marks.length-1;r>=-1;r--)n=i.childPos(n.off,1),i=i.children[n.i],e(r>=0?t.marks[r].node:t.text,i)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,r=!i&&!(this.view.state.facet(oi)||this.dom.tabIndex>-1)&&Oe(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||e||r))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(s.anchor)),l=s.empty?a:this.moveToLine(this.domAtPos(s.head));if(Ge.gecko&&s.empty&&!this.hasComposition&&(1==(c=a).node.nodeType&&c.node.firstChild&&(0==c.offset||"false"==c.node.childNodes[c.offset-1].contentEditable)&&(c.offset==c.node.childNodes.length||"false"==c.node.childNodes[c.offset].contentEditable))){let t=document.createTextNode("");this.view.observer.ignore((()=>a.node.insertBefore(t,a.node.childNodes[a.offset]||null))),a=l=new Re(t,0),o=!0}var c;let O=this.view.observer.selectionRange;!o&&O.focusNode&&(ue(a.node,a.offset,O.anchorNode,O.anchorOffset)&&ue(l.node,l.offset,O.focusNode,O.focusOffset)||this.suppressWidgetCursorChange(O,s))||(this.view.observer.ignore((()=>{Ge.android&&Ge.chrome&&this.dom.contains(O.focusNode)&&function(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(O.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=le(this.view.root);if(t)if(s.empty){if(Ge.gecko){let t=(e=a.node,i=a.offset,1!=e.nodeType?0:(i&&"false"==e.childNodes[i-1].contentEditable?1:0)|(is.head&&([a,l]=[l,a]),e.setEnd(l.node,l.offset),e.setStart(a.node,a.offset),t.removeAllRanges(),t.addRange(e)}else;var e,i;r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new Re(O.anchorNode,O.anchorOffset),this.impreciseHead=l.precise?null:new Re(O.focusNode,O.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&ue(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,n=le(t.root),{anchorNode:i,anchorOffset:r}=t.observer.selectionRange;if(!(n&&e.empty&&e.assoc&&n.modify))return;let o=gn.find(this,e.head);if(!o)return;let s=o.posAtStart;if(e.head==s||e.head==s+o.length)return;let a=this.coordsAt(e.head,-1),l=this.coordsAt(e.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(e.head+e.assoc);n.collapse(c.node,c.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let O=t.observer.selectionRange;t.docView.posFromDOM(O.anchorNode,O.anchorOffset)!=e.from&&n.collapse(i,r)}moveToLine(t){let e,n=this.dom;if(t.node!=n)return t;for(let i=t.offset;!e&&i=0;i--){let t=ze.get(n.childNodes[i]);t instanceof gn&&(e=t.domAtPos(t.length))}return e?new Re(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=ze.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let n=this.nearest(t);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(t,e)+n.posAtStart}domAtPos(t){let{i:e,off:n}=this.childCursor().findPos(t,-1);for(;e=0;o--){let s=this.children[o],a=r-s.breakAfter,l=a-s.length;if(at||s.covers(1))&&(!n||s instanceof gn&&!(n instanceof gn&&e>=0)))n=s,i=l;else if(n&&l==t&&a==t&&s instanceof yn&&Math.abs(e)<2){if(s.deco.startSide<0)break;o&&(n=null)}r=l}return n?n.coordsAt(t-i,e):null}coordsForChar(t){let{i:e,off:n}=this.childPos(t,1),i=this.children[e];if(!(i instanceof gn))return null;for(;i.children.length;){let{i:t,off:e}=i.childPos(n,1);for(;;t++){if(t==i.children.length)return null;if((i=i.children[t]).length)break}n=e}if(!(i instanceof Be))return null;let r=w(i.text,n);if(r==n)return null;let o=we(i.dom,n,r).getClientRects();for(let t=0;tMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==bn.LTR;for(let t=0,l=0;li)break;if(t>=n){let n=c.dom.getBoundingClientRect();if(e.push(n.height),o){let e=c.dom.lastChild,i=e?he(e):[];if(i.length){let e=i[i.length-1],o=a?e.right-n.left:n.right-e.left;o>s&&(s=o,this.minWidth=r,this.minWidthFrom=t,this.minWidthTo=O)}}}t=O+c.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?bn.RTL:bn.LTR}measureTextSize(){for(let t of this.children)if(t instanceof gn){let e=t.measureTextSize();if(e)return e}let t,e,n,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(i);let r=he(i.firstChild)[0];t=i.getBoundingClientRect().height,e=r?r.width/27:7,n=r?r.height:t,i.remove()})),{lineHeight:t,charWidth:e,textHeight:n}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new qe(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let n=0,i=0;;i++){let r=i==e.viewports.length?null:e.viewports[i],o=r?r.from-1:this.length;if(o>n){let i=(e.lineBlockAt(o).bottom-e.lineBlockAt(n).top)/this.view.scaleY;t.push(hn.replace({widget:new vn(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return hn.set(t)}updateDeco(){let t=1,e=this.view.state.facet(ui).map((e=>(this.dynamicDecorationMap[t++]="function"==typeof e)?e(this.view):e)),n=!1,i=this.view.state.facet(di).map(((t,e)=>{let i="function"==typeof t;return i&&(n=!0),i?t(this.view):t}));for(i.length&&(this.dynamicDecorationMap[t++]=n,e.push(Vt.join(i))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];tn.anchor?-1:1);if(!i)return;!n.empty&&(e=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,e.left),top:Math.min(i.top,e.top),right:Math.max(i.right,e.right),bottom:Math.max(i.bottom,e.bottom)});let r=yi(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;!function(t,e,n,i,r,o,s,a){let l=t.ownerDocument,c=l.defaultView||window;for(let O=t,h=!1;O&&!h;)if(1==O.nodeType){let t,u=O==l.body,d=1,f=1;if(u)t=ye(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(O).position)&&(h=!0),O.scrollHeight<=O.clientHeight&&O.scrollWidth<=O.clientWidth){O=O.assignedSlot||O.parentNode;continue}let e=O.getBoundingClientRect();({scaleX:d,scaleY:f}=ve(O,e)),t={left:e.left,right:e.left+O.clientWidth*d,top:e.top,bottom:e.top+O.clientHeight*f}}let p=0,m=0;if("nearest"==r)e.top0&&e.bottom>t.bottom+m&&(m=e.bottom-t.bottom+s)):e.bottom>t.bottom&&(m=e.bottom-t.bottom+s,n<0&&e.top-m0&&e.right>t.right+p&&(p=e.right-t.right+o)):e.right>t.right&&(p=e.right-t.right+o,n<0&&e.leftt.bottom||e.leftt.right)&&(e={left:Math.max(e.left,t.left),right:Math.min(e.right,t.right),top:Math.max(e.top,t.top),bottom:Math.min(e.bottom,t.bottom)}),O=O.assignedSlot||O.parentNode}else{if(11!=O.nodeType)break;O=O.host}}(this.view.scrollDOM,o,n.headt?e.left-t:Math.max(0,t-e.right)}function Pi(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function _i(t,e){return t.tope.top+1}function ki(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Ri(t,e,n){let i,r,o,s,a,l,c,O,h=!1;for(let u=t.firstChild;u;u=u.nextSibling){let t=he(u);for(let d=0;dm||s==m&&o>p){i=u,r=f,o=p,s=m;let a=m?n0?d0)}0==p?n>f.bottom&&(!c||c.bottomf.top)&&(l=u,O=f):c&&_i(c,f)?c=Ti(c,f.bottom):O&&_i(O,f)&&(O=ki(O,f.top))}}if(c&&c.bottom>=n?(i=a,r=c):O&&O.top<=n&&(i=l,r=O),!i)return{node:t,offset:0};let u=Math.max(r.left,Math.min(r.right,e));return 3==i.nodeType?Xi(i,u,n):h&&"false"!=i.contentEditable?Ri(i,u,n):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,i)+(e>=(r.left+r.right)/2?1:0)}}function Xi(t,e,n){let i=t.nodeValue.length,r=-1,o=1e9,s=0;for(let a=0;an?c.top-n:n-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&O=(c.left+c.right)/2,i=n;if(Ge.chrome||Ge.gecko){we(t,a).getBoundingClientRect().left==c.right&&(i=!n)}if(O<=0)return{node:t,offset:a+(i?1:0)};r=a+(i?1:0),o=O}}}return{node:t,offset:r>-1?r:s>0?t.nodeValue.length:0}}function zi(t,e,n,i=-1){var r,o;let s,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,{docHeight:c}=t.viewState,{x:O,y:h}=e,u=h-l;if(u<0)return 0;if(u>c)return t.state.doc.length;for(let e=t.viewState.heightOracle.textHeight/2,r=!1;s=t.elementAtHeight(u),s.type!=On.Text;)for(;u=i>0?s.bottom+e:s.top-e,!(u>=0&&u<=c);){if(r)return n?null:0;r=!0,i=-i}h=l+u;let d=s.from;if(dt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:Ci(t,a,s,O,h);let f=t.dom.ownerDocument,p=t.root.elementFromPoint?t.root:f,m=p.elementFromPoint(O,h);m&&!t.contentDOM.contains(m)&&(m=null),m||(O=Math.max(a.left+1,Math.min(a.right-1,O)),m=p.elementFromPoint(O,h),m&&!t.contentDOM.contains(m)&&(m=null));let g,y=-1;if(m&&0!=(null===(r=t.docView.nearest(m))||void 0===r?void 0:r.isEditable)){if(f.caretPositionFromPoint){let t=f.caretPositionFromPoint(O,h);t&&({offsetNode:g,offset:y}=t)}else if(f.caretRangeFromPoint){let e=f.caretRangeFromPoint(O,h);e&&(({startContainer:g,startOffset:y}=e),(!t.contentDOM.contains(g)||Ge.safari&&function(t,e,n){let i;if(3!=t.nodeType||e!=(i=t.nodeValue.length))return!1;for(let e=t.nextSibling;e;e=e.nextSibling)if(1!=e.nodeType||"BR"!=e.nodeName)return!1;return we(t,i-1,i).getBoundingClientRect().left>n}(g,y,O)||Ge.chrome&&function(t,e,n){if(0!=e)return!1;for(let e=t;;){let t=e.parentNode;if(!t||1!=t.nodeType||t.firstChild!=e)return!1;if(t.classList.contains("cm-line"))break;e=t}let i=1==t.nodeType?t.getBoundingClientRect():we(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-i.left>5}(g,y,O))&&(g=void 0))}g&&(y=Math.min(me(g),y))}if(!g||!t.docView.dom.contains(g)){let e=gn.find(t.docView,d);if(!e)return u>s.top+s.height/2?s.to:s.from;({node:g,offset:y}=Ri(e.dom,O,h))}let v=t.docView.nearest(g);if(!v)return null;if(v.isWidget&&1==(null===(o=v.dom)||void 0===o?void 0:o.nodeType)){let t=v.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;o+=Math.floor((r-n.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let s=t.state.sliceDoc(n.from,n.to);return n.from+Bt(s,o,t.state.tabSize)}function qi(t,e,n){let i=t.lineBlockAt(e);if(Array.isArray(i.type)){let t;for(let r of i.type){if(r.from>e)break;if(!(r.toe)return r;t&&(r.type!=On.Text||t.type==r.type&&!(n<0?r.frome))||(t=r)}}return t||i}return i}function Ei(t,e,n,i){let r=t.state.doc.lineAt(e.head),o=t.bidiSpans(r),s=t.textDirectionAt(r.from);for(let a=e,l=null;;){let e=Dn(r,o,s,a,n),c=Yn;if(!e){if(r.number==(n?t.state.doc.lines:1))return a;c="\n",r=t.state.doc.line(r.number+(n?1:-1)),o=t.bidiSpans(r),e=t.visualLineSide(r,!n)}if(l){if(!l(c))return a}else{if(!i)return e;l=i(c)}a=e}}function Vi(t,e,n){for(;;){let i=0;for(let r of t)r.between(e-1,e+1,((t,r,o)=>{if(e>t&&ee(t))),n.from,e.head>n.from?-1:1);return i==n.from?n:W.cursor(i,it)&&this.lineBreak(),i=r}return this.findPointBefore(n,e),this}readTextNode(t){let e=t.nodeValue;for(let n of this.points)n.node==t&&(n.pos=this.text.length+Math.min(n.offset,e.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r,o=-1,s=1;if(this.lineSeparator?(o=e.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(r=i.exec(e))&&(o=r.index,s=r[0].length),this.append(e.slice(n,o<0?e.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=s-1);n=o+s}}readNode(t){if(t.cmIgnore)return;let e=ze.get(t),n=e&&e.overrideDOMText;if(null!=n){this.findPointInside(t,n.length);for(let t=n.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let n of this.points)n.node==t&&t.childNodes[n.offset]==e&&(n.pos=this.text.length)}findPointInside(t,e){for(let n of this.points)(3==t.nodeType?n.node==t:t.contains(n.node))&&(n.pos=this.text.length+(Yi(t,n.node,n.offset)?e:0))}}function Yi(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:r,impreciseAnchor:o}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,n,0))){let e=r||o?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}=t.observer.selectionRange;n&&(e.push(new Di(n,i)),r==n&&o==i||e.push(new Di(r,o)));return e}(t),n=new Wi(e,t.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(t,e){if(0==t.length)return null;let n=t[0].pos,i=2==t.length?t[1].pos:n;return n>-1&&i>-1?W.single(n+e,i+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,n=r&&r.node==e.focusNode&&r.offset==e.focusOffset||!ce(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),i=o&&o.node==e.anchorNode&&o.offset==e.anchorOffset||!ce(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset),s=t.viewport;if((Ge.ios||Ge.chrome)&&t.state.selection.main.empty&&n!=i&&(s.from>0||s.toDate.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:i,to:s}=e.bounds,a=r.from,l=null;(8===o||Ge.android&&e.text.length0&&a>0&&t.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if("end"==i){n-=s+Math.max(0,o-Math.min(s,a))-o}if(s=s?o-n:0,a=o+(a-s),s=o}else if(a=a?o-n:0,s=o+(s-a),a=o}return{from:o,toA:s,toB:a}}(t.state.doc.sliceString(i,s,Ai),e.text,a-i,l);c&&(Ge.chrome&&13==o&&c.toB==c.from+2&&e.text.slice(c.from,c.toB)==Ai+Ai&&c.toB--,n={from:i+c.from,to:i+c.toA,insert:f.of(e.text.slice(c.from,c.toB).split(Ai))})}else i&&(!t.hasFocus&&t.state.facet(oi)||i.main.eq(r))&&(i=null);if(!n&&!i)return!1;if(!n&&e.typeOver&&!r.empty&&i&&i.main.empty?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:(Ge.mac||Ge.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=W.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:f.of([n.insert.toString().replace("."," ")])}):n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,r.to))}:Ge.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&t.lineWrapping&&(i&&(i=W.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:f.of([" "])}),n)return ji(t,n,i,o);if(i&&!i.main.eq(r)){let e=!1,n="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(e=!0),n=t.inputState.lastSelectionOrigin),t.dispatch({selection:i,scrollIntoView:e,userEvent:n}),!0}return!1}function ji(t,e,n,i=-1){if(Ge.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(Ge.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&" "==t.state.sliceDoc(e.from,r.from))&&1==e.insert.length&&2==e.insert.lines&&xe(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&0==e.insert.length||8==i&&e.insert.lengthr.head)&&xe(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&0==e.insert.length&&xe(t.contentDOM,"Delete",46)))return!0;let o,s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a=()=>o||(o=function(t,e,n){let i,r=t.state,o=r.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let n=o.frome.to?r.sliceDoc(e.to,o.to):"";i=r.replaceSelection(t.state.toText(n+e.insert.sliceString(0,void 0,t.state.lineBreak)+s))}else{let s=r.changes(e),a=n&&n.main.to<=s.newLength?n.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){let l,c=t.state.sliceDoc(e.from,e.to),O=n&&bi(t,n.main.head);if(O){let t=e.insert.length-(e.to-e.from);l={from:O.from,to:O.to-t}}else l=t.state.doc.lineAt(o.head);let h=o.to-e.to,u=o.to-o.from;i=r.changeByRange((n=>{if(n.from==o.from&&n.to==o.to)return{changes:s,range:a||n.map(s)};let i=n.to-h,O=i-c.length;if(n.to-n.from!=u||t.state.sliceDoc(O,i)!=c||n.to>=l.from&&n.from<=l.to)return{range:n};let d=r.changes({from:O,to:i,insert:e.insert}),f=n.to-o.to;return{changes:d,range:a?W.range(Math.max(0,a.anchor+f),Math.max(0,a.head+f)):n.map(d)}}))}else i={changes:s,selection:a&&r.selection.replaceRange(a)}}let s="input.type";(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,s+=".compose",t.inputState.compositionFirstChange&&(s+=".start",t.inputState.compositionFirstChange=!1));return r.update(i,{userEvent:s,scrollIntoView:!0})}(t,e,n));return t.state.facet(Gn).some((n=>n(t,e.from,e.to,s,a)))||t.dispatch(a()),!0}class Li{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Ge.safari&&t.contentDOM.addEventListener("input",(()=>null)),Ge.gecko&&function(t){yr.has(t)||(yr.add(t),t.addEventListener("copy",(()=>{})),t.addEventListener("cut",(()=>{})))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n,i=e.target;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=ze.get(i))&&n.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||(0!=this.view.updateState?Promise.resolve().then((()=>this.runHandlers(t.type,t))):this.runHandlers(t.type,t)))}runHandlers(t,e){let n=this.handlers[t];if(n){for(let t of n.observers)t(this.view,e);for(let t of n.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=Ni(t),n=this.handlers,i=this.view.contentDOM;for(let t in e)if("scroll"!=t){let r=!e[t].handlers.length,o=n[t];o&&r!=!o.handlers.length&&(i.removeEventListener(t,this.handleEvent),o=null),o||i.addEventListener(t,this.handleEvent,{passive:r})}for(let t in n)"scroll"==t||e[t]||i.removeEventListener(t,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=t.keyCode&&Fi.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Ge.android&&Ge.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return!Ge.ios||t.synthetic||t.altKey||t.metaKey||!((e=Gi.find((e=>e.keyCode==t.keyCode)))&&!t.ctrlKey||Bi.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&(!("Enter"==e.key&&t&&t.from0||!!(Ge.safari&&!Ge.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Ii(t,e){return(n,i)=>{try{return e.call(t,i,n)}catch(t){ri(n.state,t)}}}function Ni(t){let e=Object.create(null);function n(t){return e[t]||(e[t]={observers:[],handlers:[]})}for(let e of t){let t=e.spec;if(t&&t.domEventHandlers)for(let i in t.domEventHandlers){let r=t.domEventHandlers[i];r&&n(i).handlers.push(Ii(e.value,r))}if(t&&t.domEventObservers)for(let i in t.domEventObservers){let r=t.domEventObservers[i];r&&n(i).observers.push(Ii(e.value,r))}}for(let t in Ji)n(t).handlers.push(Ji[t]);for(let t in tr)n(t).observers.push(tr[t]);return e}const Gi=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Bi="dthko",Fi=[16,17,18,20,91,92,224,225];function Hi(t){return.7*Math.max(0,t)+8}class Ki{constructor(t,e,n,i){this.view=t,this.startEvent=e,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParents=function(t){let e,n,i=t.ownerDocument;for(let r=t.parentNode;r&&!(r==i.body||e&&n);)if(1==r.nodeType)!n&&r.scrollHeight>r.clientHeight&&(n=r),!e&&r.scrollWidth>r.clientWidth&&(e=r),r=r.assignedSlot||r.parentNode;else{if(11!=r.nodeType)break;r=r.host}return{x:e,y:n}}(t.contentDOM),this.atoms=t.state.facet(fi).map((e=>e(t)));let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Rt.allowMultipleSelections)&&function(t,e){let n=t.state.facet(Mn);return n.length?n[0](e):Ge.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let i=le(t.root);if(!i||0==i.rangeCount)return!0;let r=i.getRangeAt(0).getClientRects();for(let t=0;t=e.clientX&&n.top<=e.clientY&&n.bottom>=e.clientY)return!0}return!1}(t,e)||1!=ur(e))&&null}start(t){!1===this.dragging&&this.select(t)}move(t){if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(e=this.startEvent,n=t,Math.max(Math.abs(e.clientX-n.clientX),Math.abs(e.clientY-n.clientY))<10))return;var e,n;this.select(this.lastEvent=t);let i=0,r=0,o=0,s=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:o,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=yi(this.view);t.clientX-c.left<=o+6?i=-Hi(o-t.clientX):t.clientX+c.right>=a-6&&(i=Hi(t.clientX-a)),t.clientY-c.top<=s+6?r=-Hi(s-t.clientY):t.clientY+c.bottom>=l-6&&(r=Hi(t.clientY-l)),this.setScrollSpeed(i,r)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:e}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),e&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=e,e=0),(t||e)&&this.view.win.scrollBy(t,e),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let n=0;nt.isUserEvent("input.type")))?this.destroy():this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}const Ji=Object.create(null),tr=Object.create(null),er=Ge.ie&&Ge.ie_version<15||Ge.ios&&Ge.webkit_version<604;function nr(t,e,n){for(let i of t.facet(e))n=i(n,t);return n}function ir(t,e){e=nr(t.state,Fn,e);let n,{state:i}=t,r=1,o=i.toText(e),s=o.lines==i.selection.ranges.length;if(null!=fr&&i.selection.ranges.every((t=>t.empty))&&fr==o.toString()){let t=-1;n=i.changeByRange((n=>{let a=i.doc.lineAt(n.from);if(a.from==t)return{range:n};t=a.from;let l=i.toText((s?o.line(r++).text:e)+i.lineBreak);return{changes:{from:a.from,insert:l},range:W.cursor(n.from+l.length)}}))}else n=s?i.changeByRange((t=>{let e=o.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:W.cursor(t.from+e.length)}})):i.replaceSelection(o);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function rr(t,e,n,i){if(1==i)return W.cursor(e,n);if(2==i)return function(t,e,n=1){let i=t.charCategorizer(e),r=t.doc.lineAt(e),o=e-r.from;if(0==r.length)return W.cursor(e);0==o?n=1:o==r.length&&(n=-1);let s=o,a=o;n<0?s=w(r.text,o,!1):a=w(r.text,o);let l=i(r.text.slice(s,a));for(;s>0;){let t=w(r.text,s,!1);if(i(r.text.slice(t,s))!=l)break;s=t}for(;a{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},Ji.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&0!=t.inputState.tabFocusMode&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),tr.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},tr.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Ji.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of t.state.facet(Ln))if(n=i(t,e),n)break;if(n||0!=e.button||(n=function(t,e){let n=ar(t,e),i=ur(e),r=t.state.selection;return{update(t){t.docChanged&&(n.pos=t.changes.mapPos(n.pos),r=r.map(t.changes))},get(e,o,s){let a,l=ar(t,e),c=rr(t,l.pos,l.bias,i);if(n.pos!=l.pos&&!o){let e=rr(t,n.pos,n.bias,i),r=Math.min(e.from,c.from),o=Math.max(e.to,c.to);c=r1&&(a=function(t,e){for(let n=0;n=e)return W.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}(r,l.pos))?a:s?r.addRange(c):W.create([c])}}}(t,e)),n){let i=!t.hasFocus;t.inputState.startMouseSelection(new Ki(t,e,n,i)),i&&t.observer.ignore((()=>{be(t.contentDOM);let e=t.root.activeElement;e&&!e.contains(t.contentDOM)&&e.blur()}));let r=t.inputState.mouseSelection;if(r)return r.start(e),!1===r.dragging}return!1};let or=(t,e,n)=>e>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function sr(t,e,n,i){let r=gn.find(t.docView,e);if(!r)return 1;let o=e-r.posAtStart;if(0==o)return 1;if(o==r.length)return-1;let s=r.coordsAt(o,-1);if(s&&or(n,i,s))return-1;let a=r.coordsAt(o,1);return a&&or(n,i,a)?1:s&&s.bottom>=i?-1:1}function ar(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:sr(t,n,e.clientX,e.clientY)}}const lr=Ge.ie&&Ge.ie_version<=11;let cr=null,Or=0,hr=0;function ur(t){if(!lr)return t.detail;let e=cr,n=hr;return cr=t,hr=Date.now(),Or=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Or+1)%3:1}function dr(t,e,n,i){if(!(n=nr(t.state,Fn,n)))return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=t.inputState,s=i&&o&&function(t,e){let n=t.state.facet(jn);return n.length?n[0](e):Ge.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:o.from,to:o.to}:null,a={from:r,insert:n},l=t.state.changes(s?[s,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ji.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.nearest(e.target);if(i&&i.isWidget){let t=i.posAtStart,e=t+i.length;(t>=n.to||e<=n.from)&&(n=W.range(t,e))}}let{inputState:i}=t;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",nr(t.state,Hn,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Ji.dragend=t=>(t.inputState.draggedContent=null,!1),Ji.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,o=()=>{++r==n.length&&dr(t,e,i.filter((t=>null!=t)).join(t.state.lineBreak),!1)};for(let t=0;t{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(i[t]=e.result),o()},e.readAsText(n[t])}return!0}{let n=e.dataTransfer.getData("Text");if(n)return dr(t,e,n,!0),!0}return!1},Ji.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=er?null:e.clipboardData;return n?(ir(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((()=>{t.focus(),n.remove(),ir(t,n.value)}),50)}(t),!1)};let fr=null;Ji.copy=Ji.cut=(t,e)=>{let{text:n,ranges:i,linewise:r}=function(t){let e=[],n=[],i=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let r=-1;for(let{from:i}of t.selection.ranges){let o=t.doc.lineAt(i);o.number>r&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),r=o.number}i=!0}return{text:nr(t,Hn,e.join(t.lineBreak)),ranges:n,linewise:i}}(t.state);if(!n&&!r)return!1;fr=r?n:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=er?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(function(t,e){let n=t.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout((()=>{i.remove(),t.focus()}),50)}(t,n),!1)};const pr=pt.define();function mr(t,e){let n=[];for(let i of t.facet(Bn)){let r=i(t,e);r&&n.push(r)}return n.length?t.update({effects:n,annotations:pr.of(!0)}):null}function gr(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=mr(t.state,e);n?t.dispatch(n):t.update([])}}),10)}tr.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),gr(t)},tr.blur=t=>{t.observer.clearSelectionRange(),gr(t)},tr.compositionstart=tr.compositionupdate=t=>{t.observer.editContext||(null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},tr.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ge.chrome&&Ge.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])}),50))},tr.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Ji.beforeinput=(t,e)=>{var n,i;if("insertReplacementText"==e.inputType&&t.observer.editContext){let i=null===(n=e.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),r=e.getTargetRanges();if(i&&r.length){let e=r[0],n=t.posAtDOM(e.startContainer,e.startOffset),o=t.posAtDOM(e.endContainer,e.endOffset);return ji(t,{from:n,to:o,insert:t.state.toText(i)},null),!0}}let r;if(Ge.chrome&&Ge.android&&(r=Gi.find((t=>t.inputType==e.inputType)))&&(t.observer.delayAndroidKey(r.key,r.keyCode),"Backspace"==r.key||"Delete"==r.key)){let e=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}return Ge.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),Ge.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout((()=>tr.compositionend(t,e)),20),!1};const yr=new Set;const vr=["pre-wrap","normal","pre-line","break-spaces"];let $r=!1;function Qr(){$r=!1}class Sr{constructor(t){this.lineWrapping=t,this.doc=f.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,e){let n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(t){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return vr.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let n=0;n-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=e,this.charWidth=n,this.textHeight=i,this.lineLength=r,a){this.heightSamples={};for(let t=0;t0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>Pr&&($r=!0),this.height=t)}replace(t,e,n){return _r.of(n)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,n,i){let r=this,o=n.doc;for(let s=i.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:O}=i[s],h=r.lineAt(a,xr.ByPosNoHeight,n.setDoc(e),0,0),u=h.to>=l?h:r.lineAt(l,xr.ByPosNoHeight,n,0,0);for(O+=u.to-l,l=u.to;s>0&&h.from<=i[s-1].toA;)a=i[s-1].fromA,c=i[s-1].fromB,s--,a2*r){let r=t[e-1];r.break?t.splice(--e,1,r.left,null,r.right):t.splice(--e,1,r.left,r.right),n+=1+r.break,i-=r.size}else{if(!(r>2*i))break;{let e=t[n];e.break?t.splice(n,1,e.left,null,e.right):t.splice(n,1,e.left,e.right),n+=2+e.break,r-=e.size}}else if(i=r&&o(this.blockAt(0,n,i,r))}updateHeight(t,e=0,n=!1,i){return i&&i.from<=e&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Rr extends Tr{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,n,i){return new wr(i,this.length,n,this.height,this.breaks)}replace(t,e,n){let i=n[0];return 1==n.length&&(i instanceof Rr||i instanceof Xr&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Xr?i=new Rr(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):_r.of(n)}updateHeight(t,e=0,n=!1,i){return i&&i.from<=e&&i.more?this.setHeight(i.heights[i.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Xr extends _r{constructor(t){super(t,0)}heightMetrics(t,e){let n,i=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,o=r-i+1,s=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*o);n=e/o,this.length>o+1&&(s=(this.height-e)/(this.length-o-1))}else n=this.height/o;return{firstLine:i,lastLine:r,perLine:n,perChar:s}}blockAt(t,e,n,i){let{firstLine:r,lastLine:o,perLine:s,perChar:a}=this.heightMetrics(e,i);if(e.lineWrapping){let r=i+(t0){let t=n[n.length-1];t instanceof Xr?n[n.length-1]=new Xr(t.length+i):n.push(null,new Xr(i-1))}if(t>0){let e=n[0];e instanceof Xr?n[0]=new Xr(t+e.length):n.unshift(new Xr(t-1),null)}return _r.of(n)}decomposeLeft(t,e){e.push(new Xr(t-1),null)}decomposeRight(t,e){e.push(null,new Xr(this.length-t-1))}updateHeight(t,e=0,n=!1,i){let r=e+this.length;if(i&&i.from<=e+this.length&&i.more){let n=[],o=Math.max(e,i.from),s=-1;for(i.from>e&&n.push(new Xr(i.from-e-1).updateHeight(t,e));o<=r&&i.more;){let e=t.doc.lineAt(o).length;n.length&&n.push(null);let r=i.heights[i.index++];-1==s?s=r:Math.abs(r-s)>=Pr&&(s=-2);let a=new Rr(e,r);a.outdated=!1,n.push(a),o+=e+1}o<=r&&n.push(null,new Xr(r-o).updateHeight(t,o));let a=_r.of(n);return(s<0||Math.abs(a.height-this.height)>=Pr||Math.abs(s-this.heightMetrics(t,e).perLine)>=Pr)&&($r=!0),kr(this,a)}return(n||this.outdated)&&(this.setHeight(t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class zr extends _r{constructor(t,e,n){super(t.length+e+n.length,t.height+n.height,e|(t.outdated||n.outdated?2:0)),this.left=t,this.right=n,this.size=t.size+n.size}get break(){return 1&this.flags}blockAt(t,e,n,i){let r=n+this.left.height;return ts))return l;let c=e==xr.ByPosNoHeight?xr.ByPosNoHeight:xr.ByPos;return a?l.join(this.right.lineAt(s,c,n,o,s)):this.left.lineAt(s,c,n,i,r).join(l)}forEachLine(t,e,n,i,r,o){let s=i+this.left.height,a=r+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,n,s,a,o);else{let l=this.lineAt(a,xr.ByPos,n,i,r);t=t&&l.from<=e&&o(l),e>l.to&&this.right.forEachLine(l.to+1,e,n,s,a,o)}}replace(t,e,n){let i=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-i,e-i,n));let r=[];t>0&&this.decomposeLeft(t,r);let o=r.length;for(let t of n)r.push(t);if(t>0&&Cr(r,o-1),e=n&&e.push(null)),t>n&&this.right.decomposeLeft(t-n,e)}decomposeRight(t,e){let n=this.left.length,i=n+this.break;if(t>=i)return this.right.decomposeRight(t-i,e);t2*e.size||e.size>2*t.size?_r.of(this.break?[t,null,e]:[t,e]):(this.left=kr(this.left,t),this.right=kr(this.right,e),this.setHeight(t.height+e.height),this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,n=!1,i){let{left:r,right:o}=this,s=e+r.length+this.break,a=null;return i&&i.from<=e+r.length&&i.more?a=r=r.updateHeight(t,e,n,i):r.updateHeight(t,e,n),i&&i.from<=s+o.length&&i.more?a=o=o.updateHeight(t,s,n,i):o.updateHeight(t,s,n),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Cr(t,e){let n,i;null==t[e]&&(n=t[e-1])instanceof Xr&&(i=t[e+1])instanceof Xr&&t.splice(e-1,3,new Xr(n.length+1+i.length))}class qr{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Rr?n.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Rr(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,n){if(t=5)&&this.addLineDeco(i,r,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Rr(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let n=new Xr(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Rr)return t;let e=new Rr(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,t),i.breaks+=e,this.writtenTo=this.pos=this.pos+n}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Rr||this.isCovered?(this.writtenTon.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();o=Math.max(o,i.left),s=Math.min(s,i.right),a=Math.max(a,i.top),l=Math.min(e==t.parentNode?r.innerHeight:l,i.bottom)}e="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function Zr(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class Ar{constructor(t,e,n,i){this.from=t,this.to=e,this.size=n,this.displaySize=i}static same(t,e){if(t.length!=e.length)return!1;for(let n=0;n"function"!=typeof t&&"cm-lineWrapping"==t.class));this.heightOracle=new Sr(e),this.stateDeco=t.facet(ui).filter((t=>"function"!=typeof t)),this.heightMap=_r.empty().applyChanges(this.stateDeco,f.empty,this.heightOracle.setDoc(t.doc),[new $i(0,0,0,t.doc.length)]);for(let t=0;t<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());t++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=hn.set(this.lineGaps.map((t=>t.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let n=0;n<=1;n++){let i=n?e.head:e.anchor;if(!t.some((({from:t,to:e})=>i>=t&&i<=e))){let{from:e,to:n}=this.lineBlockAt(i);t.push(new Dr(e,n))}}return this.viewports=t.sort(((t,e)=>t.from-e.from)),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?jr:new Lr(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(t=>{this.viewportLines.push(Ir(t,this.scaler))}))}update(t,e=null){this.state=t.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ui).filter((t=>"function"!=typeof t));let i=t.changedRanges,r=$i.extendWithRanges(i,function(t,e,n){let i=new Er;return Vt.compare(t,e,n,i,0),i.changes}(n,this.stateDeco,t?t.changes:X.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Qr(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||$r)&&(t.flags|=2),s?(this.scrollAnchorPos=t.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let l=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,t.flags|=this.updateForViewport(),(l||!t.changes.empty||2&t.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Jn)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,n=window.getComputedStyle(e),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?bn.RTL:bn.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),s=e.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let l=0,c=0;if(s.width&&s.height){let{scaleX:t,scaleY:n}=ve(e,s);(t>.005&&Math.abs(this.scaleX-t)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=t,this.scaleY=n,l|=16,o=a=!0)}let O=(parseInt(n.paddingTop)||0)*this.scaleY,h=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==O&&this.paddingBottom==h||(this.paddingTop=O,this.paddingBottom=h,l|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,l|=16);let u=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=u&&(this.scrollAnchorHeight=-1,this.scrollTop=u),this.scrolledToBottom=_e(t.scrollDOM);let d=(this.printing?Zr:Vr)(e,this.paddingTop),p=d.top-this.pixelViewport.top,m=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(a=!0)),!this.inView&&!this.scrollTarget&&!function(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}(t.dom))return 0;let y=s.width;if(this.contentDOMWidth==y&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=t.scrollDOM.clientHeight,l|=16),a){let e=t.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(e)&&(o=!0),o||i.lineWrapping&&Math.abs(y-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:s,textHeight:a}=t.docView.measureTextSize();o=n>0&&i.refresh(r,n,s,a,y/s,e),o&&(t.docView.minWidth=0,l|=16)}p>0&&m>0?c=Math.max(p,m):p<0&&m<0&&(c=Math.min(p,m)),Qr();for(let n of this.viewports){let r=n.from==this.viewport.from?e:t.docView.measureVisibleLineHeights(n);this.heightMap=(o?_r.empty().applyChanges(this.stateDeco,f.empty,this.heightOracle,[new $i(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new br(n.from,r))}$r&&(l|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(2&l&&(l|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),l|=this.updateForViewport()),(2&l||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,a=new Dr(i.lineAt(o-1e3*n,xr.ByHeight,r,0,0).from,i.lineAt(s+1e3*(1-n),xr.ByHeight,r,0,0).to);if(e){let{head:t}=e.range;if(ta.to){let n,o=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=i.lineAt(t,xr.ByPos,r,0,0);n="center"==e.y?(s.top+s.bottom)/2-o/2:"start"==e.y||"nearest"==e.y&&t=s+Math.max(10,Math.min(n,250)))&&i>o-2e3&&r>1,o=i<<1;if(this.defaultTextDirection!=bn.LTR&&!n)return[];let s=[],a=(i,o,l,c)=>{if(o-ii&&tt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-i)t.frome))));if(!u){if(ot.from<=o&&t.to>=o))){let t=e.moveToLineBoundary(W.cursor(o),!1,!0).head;t>i&&(o=t)}let t=this.gapSize(l,i,o,c);u=new Ar(i,o,t,n||t<2e6?t:2e6)}s.push(u)},l=e=>{if(e.lengthr&&(i.push({from:r,to:t}),o+=t-r),r=e}},20),r2e6)for(let n of t)n.from>=e.from&&n.frome.from&&a(e.from,s,e,r),lt.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(t){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];Vt.spans(e,this.viewport.from,this.viewport.to,{span(t,e){n.push({from:t,to:e})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let e=0;e=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((e=>e.from<=t&&e.to>=t))||Ir(this.heightMap.lineAt(t,xr.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find((e=>e.top<=t&&e.bottom>=t))||Ir(this.heightMap.lineAt(this.scaler.fromDOM(t),xr.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Ir(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Dr{constructor(t,e){this.from=t,this.to=e}}function Ur({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let i=Math.floor(t*n);for(let t=0;;t++){let{from:n,to:r}=e[t],o=r-n;if(i<=o)return n+i;i-=o}}function Mr(t,e){let n=0;for(let{from:i,to:r}of t.ranges){if(e<=r){n+=e-i;break}n+=r-i}return n/t.total}const jr={toDOM:t=>t,fromDOM:t=>t,scale:1,eq(t){return t==this}};class Lr{constructor(t,e,n){let i=0,r=0,o=0;this.viewports=n.map((({from:n,to:r})=>{let o=e.lineAt(n,xr.ByPos,t,0,0).top,s=e.lineAt(r,xr.ByPos,t,0,0).bottom;return i+=s-o,{from:n,to:r,top:o,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-i)/(e.height-i);for(let t of this.viewports)t.domTop=o+(t.top-r)*this.scale,o=t.domBottom=t.domTop+(t.bottom-t.top),r=t.bottom}toDOM(t){for(let e=0,n=0,i=0;;e++){let r=ee.from==t.viewports[n].from&&e.to==t.viewports[n].to)))}}function Ir(t,e){if(1==e.scale)return t;let n=e.toDOM(t.top),i=e.toDOM(t.bottom);return new wr(t.from,t.length,n,i-n,Array.isArray(t._content)?t._content.map((t=>Ir(t,e))):t._content)}const Nr=U.define({combine:t=>t.join(" ")}),Gr=U.define({combine:t=>t.indexOf(!0)>-1}),Br=Jt.newName(),Fr=Jt.newName(),Hr=Jt.newName(),Kr={"&light":"."+Fr,"&dark":"."+Hr};function Jr(t,e,n){return new Jt(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,(e=>{if("&"==e)return t;if(!n||!n[e])throw new RangeError(`Unsupported selector: ${e}`);return n[e]})):t+" "+e})}const to=Jr("."+Br,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Kr),eo={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},no=Ge.ie&&Ge.ie_version<=11;class io{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new $e,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver((e=>{for(let t of e)this.queue.push(t);(Ge.ie&&Ge.ie_version<=11||Ge.ios&&t.composing)&&e.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),!window.EditContext||!1===t.constructor.EDIT_CONTEXT||Ge.chrome&&Ge.chrome_version<126||(this.editContext=new so(t),t.state.facet(oi)&&(t.contentDOM.editContext=this.editContext.editContext)),no&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(t){("change"!=t.type&&t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(((e,n)=>e!=t[n])))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(oi)?n.root.activeElement!=this.dom:!Oe(this.dom,i))return;let r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Ge.ie&&Ge.ie_version<=11||Ge.android&&Ge.chrome)&&!n.state.selection.main.empty&&i.focusNode&&ue(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=le(t.root);if(!e)return!1;let n=Ge.safari&&11==t.root.nodeType&&t.root.activeElement==this.dom&&function(t,e){if(e.getComposedRanges){let n=e.getComposedRanges(t.root)[0];if(n)return oo(t,n)}let n=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),n=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),n?oo(t,n):null}(this.view,e)||e;if(!n||this.selectionRange.eq(n))return!1;let i=Oe(this.dom,n);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;if(t){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&xe(this.dom,t.key,t.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,n=-1,i=!1;for(let r of t){let t=this.readMutation(r);t&&(t.typeOver&&(i=!0),-1==e?({from:e,to:n}=t):(e=Math.min(t.from,e),n=Math.max(t.to,n)))}return{from:e,to:n,typeOver:i}}readChange(){let{from:t,to:e,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Oe(this.dom,this.selectionRange);if(t<0&&!i)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Ui(this.view,t,e,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let n=this.view.state,i=Mi(this.view,e);return this.view.state==n&&(e.domChanged||e.newSel&&!e.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){let n=ro(e,t.previousSibling||t.target.previousSibling,-1),i=ro(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:i?e.posBefore(i):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(oi)!=t.state.facet(oi)&&(t.view.contentDOM.editContext=t.state.facet(oi)?this.editContext.editContext:null))}destroy(){var t,e,n;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ro(t,e,n){for(;e;){let i=ze.get(e);if(i&&i.parent==t)return i;let r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}function oo(t,e){let n=e.startContainer,i=e.startOffset,r=e.endContainer,o=e.endOffset,s=t.docView.domAtPos(t.state.selection.main.anchor);return ue(s.node,s.offset,r,o)&&([n,i,r,o]=[r,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}}class so{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=e=>{let n=t.state.selection.main,{anchor:i,head:r}=n,o=this.toEditorPos(e.updateRangeStart),s=this.toEditorPos(e.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:e.updateRangeStart,editorBase:o,drifted:!1});let a={from:o,to:s,insert:f.of(e.text.split("\n"))};if(a.from==this.from&&ithis.to&&(a.to=i),a.from!=a.to||a.insert.length){if((Ge.mac||Ge.android)&&a.from==r-1&&/^\. ?$/.test(e.text)&&"off"==t.contentDOM.getAttribute("autocorrect")&&(a={from:o,to:s,insert:f.of([e.text.replace("."," ")])}),this.pendingContextChange=a,!t.state.readOnly){let n=this.to-this.from+(a.to-a.from+a.insert.length);ji(t,a,W.single(this.toEditorPos(e.selectionStart,n),this.toEditorPos(e.selectionEnd,n)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state))}else{let i=W.single(this.toEditorPos(e.selectionStart),this.toEditorPos(e.selectionEnd));i.main.eq(n)||t.dispatch({selection:i,userEvent:"select"})}},this.handlers.characterboundsupdate=n=>{let i=[],r=null;for(let e=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);e{let n=[];for(let t of e.getTextFormats()){let e=t.underlineStyle,i=t.underlineThickness;if("None"!=e&&"None"!=i){let r=this.toEditorPos(t.rangeStart),o=this.toEditorPos(t.rangeEnd);if(r{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:e}=this.composing;this.composing=null,e&&this.reset(t.state)}};for(let t in this.handlers)e.addEventListener(t,this.handlers[t]);this.measureReq={read:t=>{this.editContext.updateControlBounds(t.contentDOM.getBoundingClientRect());let e=le(t.root);e&&e.rangeCount&&this.editContext.updateSelectionBounds(e.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,n=!1,i=this.pendingContextChange;return t.changes.iterChanges(((r,o,s,a,l)=>{if(n)return;let c=l.length-(o-r);if(i&&o>=i.to){if(i.from==r&&i.to==o&&i.insert.eq(l))return i=this.pendingContextChange=null,e+=c,void(this.to+=c);i=null,this.revertPending(t.state)}if(r+=e,(o+=e)<=this.from)this.from+=c,this.to+=c;else if(rthis.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),l.toString()),this.to+=c}e+=c})),i&&!n&&this.revertPending(t.state),!n}update(t){let e=this.pendingContextChange,n=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(n.from,n.to)&&t.transactions.some((t=>!t.isUserEvent("input.type")&&t.changes.touchesRange(this.from,this.to))))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):this.applyEdits(t)&&this.rangeIsValid(t.state)?(t.docChanged||t.selectionSet||e)&&this.setSelection(t.state):(this.pendingContextChange=null,this.reset(t.state)),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.from+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),i=this.toContextPos(e.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to3e4)}toEditorPos(t,e=this.to-this.from){t=Math.min(t,e);let n=this.composing;return n&&n.drifted?n.editorBase+(t-n.contextBase):t+this.from}toContextPos(t){let e=this.composing;return e&&e.drifted?e.contextBase+(t-e.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class ao{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var e;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:n}=t;this.dispatchTransactions=t.dispatchTransactions||n&&(t=>t.forEach((t=>n(t,this))))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new Yr(t.state||Rt.create(t)),t.scrollTo&&t.scrollTo.is(ni)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ai).map((t=>new ci(t)));for(let t of this.plugins)t.update(this);this.observer=new io(this),this.inputState=new Li(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Si(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(e=document.fonts)||void 0===e?void 0:e.ready)&&document.fonts.ready.then((()=>this.requestMeasure()))}dispatch(...t){let e=1==t.length&&t[0]instanceof vt?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,n=!1,i=!1,r=this.state;for(let e of t){if(e.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=e.state}if(this.destroyed)return void(this.viewState.state=r);let o=this.hasFocus,s=0,a=null;t.some((t=>t.annotation(pr)))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=mr(r,o),a||(s=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(Rt.phrases)!=this.state.facet(Rt.phrases))return this.setState(r);e=Qi.create(this,r,t),e.flags|=s;let O=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(O&&(O=O.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;O=new ei(t.empty?t:W.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(ni)&&(O=t.value.clip(this.state))}this.viewState.update(e,O),this.bidiCache=Oo.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),n=this.docView.update(e),this.state.facet(vi)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some((t=>t.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(e.startState.facet(Nr)!=e.state.facet(Nr)&&(this.viewState.mustMeasureContent=!0),(n||i||O||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!e.empty)for(let t of this.state.facet(Nn))try{t(e)}catch(t){ri(this.state,t,"update listener")}(a||c)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Mi(this,c)&&l.force&&xe(this.contentDOM,l.key,l.keyCode)}))}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new Yr(t),this.plugins=t.facet(ai).map((t=>new ci(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new Si(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(ai),n=t.state.facet(ai);if(e!=n){let i=[];for(let r of n){let n=e.indexOf(r);if(n<0)i.push(new ci(r));else{let e=this.plugins[n];e.mustUpdate=t,i.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(o<0)if(_e(n))r=-1,o=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(i);r=t.from,o=t.top}this.updateState=1;let s=this.viewState.measure(this);if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map((t=>{try{return t.read(this)}catch(t){return ri(this.state,t),co}})),c=Qi.create(this,this.state,[]),O=!1;c.flags|=s,e?e.flags|=s:e=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),O=this.docView.update(c),O&&this.docViewUpdate());for(let t=0;t1||t<-1){i+=t,n.scrollTop=i/this.scaleY,o=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(Nn))t(e)}get themeClasses(){return Br+" "+(this.state.facet(Gr)?Hr:Fr)+" "+this.state.facet(Nr)}updateAttrs(){let t=ho(this,Oi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(oi)?"true":"false",class:"cm-content",style:`${Ge.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),ho(this,hi,e);let n=this.observer.ignore((()=>{let n=an(this.contentDOM,this.contentAttrs,e),i=an(this.dom,this.editorAttrs,t);return n||i}));return this.editorAttrs=t,this.contentAttrs=e,n}showAnnouncements(t){let e=!0;for(let n of t)for(let t of n.effects)if(t.is(ao.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(vi);let t=this.state.facet(ao.cspNonce);Jt.mount(this.root,this.styleModules.concat(to).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;ee.spec==t))||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,n){return Zi(this,t,Ei(this,t,e,n))}moveByGroup(t,e){return Zi(this,t,Ei(this,t,e,(e=>function(t,e,n){let i=t.state.charCategorizer(e),r=i(n);return t=>{let e=i(t);return r==Pt.Space&&(r=e),r==e}}(this,t.head,e))))}visualLineSide(t,e){let n=this.bidiSpans(t),i=this.textDirectionAt(t.from),r=n[e?n.length-1:0];return W.cursor(r.side(e,i)+t.from,r.forward(!e,i)?1:-1)}moveToLineBoundary(t,e,n=!0){return function(t,e,n,i){let r=qi(t,e.head,e.assoc||-1),o=i&&r.type==On.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(o){let e=t.dom.getBoundingClientRect(),i=t.textDirectionAt(r.from),s=t.posAtCoords({x:n==(i==bn.LTR)?e.right-1:e.left+1,y:(o.top+o.bottom)/2});if(null!=s)return W.cursor(s,n?-1:1)}return W.cursor(n?r.to:r.from,n?-1:1)}(this,t,e,n)}moveVertically(t,e,n){return Zi(this,t,function(t,e,n,i){let r=e.head,o=n?1:-1;if(r==(n?t.state.doc.length:0))return W.cursor(r,e.assoc);let s,a=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(r,e.assoc||-1),O=t.documentTop;if(c)null==a&&(a=c.left-l.left),s=o<0?c.top:c.bottom;else{let e=t.viewState.lineBlockAt(r);null==a&&(a=Math.min(l.right-l.left,t.defaultCharacterWidth*(r-e.from))),s=(o<0?e.top:e.bottom)+O}let h=l.left+a,u=null!=i?i:t.viewState.heightOracle.textHeight>>1;for(let e=0;;e+=10){let n=s+(u+e)*o,i=zi(t,{x:h,y:n},!1,o);if(nl.bottom||(o<0?ir)){let e=t.docView.coordsForChar(i),r=!e||n0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(Kn)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>lo)return Wn(t.length);let e,n=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||qn(i.isolates,e=mi(this,t))))return i.order;e||(e=mi(this,t));let i=An(t.text,n,e);return this.bidiCache.push(new Oo(t.from,t.to,n,e,!0,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Ge.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{be(this.contentDOM),this.docView.updateSelection()}))}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return ni.of(new ei("number"==typeof t?W.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,n=this.viewState.scrollAnchorAt(t);return ni.of(new ei(W.cursor(n.from),"start","start",n.top-t,e,!0))}setTabFocusMode(t){null==t?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof t?this.inputState.tabFocusMode=t?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return li.define((()=>({})),{eventHandlers:t})}static domEventObservers(t){return li.define((()=>({})),{eventObservers:t})}static theme(t,e){let n=Jt.newName(),i=[Nr.of(n),vi.of(Jr(`.${n}`,t))];return e&&e.dark&&i.push(Gr.of(!0)),i}static baseTheme(t){return et.lowest(vi.of(Jr("."+Br,t,Kr)))}static findFromDOM(t){var e;let n=t.querySelector(".cm-content"),i=n&&ze.get(n)||ze.get(t);return(null===(e=null==i?void 0:i.rootView)||void 0===e?void 0:e.view)||null}}ao.styleModule=vi,ao.inputHandler=Gn,ao.clipboardInputFilter=Fn,ao.clipboardOutputFilter=Hn,ao.scrollHandler=ti,ao.focusChangeEffect=Bn,ao.perLineTextDirection=Kn,ao.exceptionSink=In,ao.updateListener=Nn,ao.editable=oi,ao.mouseSelectionStyle=Ln,ao.dragMovesSelection=jn,ao.clickAddsSelectionRange=Mn,ao.decorations=ui,ao.outerDecorations=di,ao.atomicRanges=fi,ao.bidiIsolatedRanges=pi,ao.scrollMargins=gi,ao.darkTheme=Gr,ao.cspNonce=U.define({combine:t=>t.length?t[0]:""}),ao.contentAttributes=hi,ao.editorAttributes=Oi,ao.lineWrapping=ao.contentAttributes.of({class:"cm-lineWrapping"}),ao.announce=yt.define();const lo=4096,co={};class Oo{constructor(t,e,n,i,r,o){this.from=t,this.to=e,this.dir=n,this.isolates=i,this.fresh=r,this.order=o}static update(t,e){if(e.empty&&!t.some((t=>t.fresh)))return t;let n=[],i=t.length?t[t.length-1].dir:bn.LTR;for(let r=Math.max(0,t.length-10);r=0;r--){let e=i[r],o="function"==typeof e?e(t):e;o&&rn(o,n)}return n}const uo=Ge.mac?"mac":Ge.windows?"win":Ge.linux?"linux":"key";function fo(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}const po=et.default(ao.domEventHandlers({keydown:(t,e)=>So(yo(e.state),t,e,"editor")})),mo=U.define({enables:po}),go=new WeakMap;function yo(t){let e=t.facet(mo),n=go.get(e);return n||go.set(e,n=function(t,e=uo){let n=Object.create(null),i=Object.create(null),r=(t,e)=>{let n=i[t];if(null==n)i[t]=e;else if(n!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},o=(t,i,o,s,a)=>{var l,c;let O=n[t]||(n[t]=Object.create(null)),h=i.split(/ (?!$)/).map((t=>function(t,e){const n=t.split(/-(?!$)/);let i,r,o,s,a=n[n.length-1];"Space"==a&&(a=" ");for(let t=0;t{let i=vo={view:e,prefix:n,scope:t};return setTimeout((()=>{vo==i&&(vo=null)}),$o),!0}]})}let u=h.join(" ");r(u,!1);let d=O[u]||(O[u]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=O._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});o&&d.run.push(o),s&&(d.preventDefault=!0),a&&(d.stopPropagation=!0)};for(let i of t){let t=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let e of t){let t=n[e]||(n[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:r}=i;for(let e in t)t[e].run.push((t=>r(t,Qo)))}let r=i[e]||i.key;if(r)for(let e of t)o(e,r,i.run,i.preventDefault,i.stopPropagation),i.shift&&o(e,"Shift-"+r,i.shift,i.preventDefault,i.stopPropagation)}return n}(e.reduce(((t,e)=>t.concat(e)),[]))),n}let vo=null;const $o=4e3;let Qo=null;function So(t,e,n,i){Qo=e;let r=function(t){var e=!(re&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||oe&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?ie:ne)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),o=_(x(r,0))==r.length&&" "!=r,s="",a=!1,l=!1,c=!1;vo&&vo.view==n&&vo.scope==i&&(s=vo.prefix+" ",Fi.indexOf(e.keyCode)<0&&(l=!0,vo=null));let O,h,u=new Set,d=t=>{if(t){for(let e of t.run)if(!u.has(e)&&(u.add(e),e(n)))return t.stopPropagation&&(c=!0),!0;t.preventDefault&&(t.stopPropagation&&(c=!0),l=!0)}return!1},f=t[i];return f&&(d(f[s+fo(r,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ge.windows&&e.ctrlKey&&e.altKey)&&(O=ne[e.keyCode])&&O!=r?(d(f[s+fo(O,e,!0)])||e.shiftKey&&(h=ie[e.keyCode])!=r&&h!=O&&d(f[s+fo(h,e,!1)]))&&(a=!0):o&&e.shiftKey&&d(f[s+fo(r,e,!0)])&&(a=!0),!a&&d(f._any)&&(a=!0)),l&&(a=!0),a&&c&&e.stopPropagation(),Qo=null,a}class bo{constructor(t,e,n,i,r){this.className=t,this.left=e,this.top=n,this.width=i,this.height=r}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,n){if(n.empty){let i=t.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let r=wo(t);return[new bo(e,i.left-r.left,i.top-r.top,null,i.bottom-i.top)]}return function(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let i=Math.max(n.from,t.viewport.from),r=Math.min(n.to,t.viewport.to),o=t.textDirection==bn.LTR,s=t.contentDOM,a=s.getBoundingClientRect(),l=wo(t),c=s.querySelector(".cm-line"),O=c&&window.getComputedStyle(c),h=a.left+(O?parseInt(O.paddingLeft)+Math.min(0,parseInt(O.textIndent)):0),u=a.right-(O?parseInt(O.paddingRight):0),d=qi(t,i,1),f=qi(t,r,-1),p=d.type==On.Text?d:null,m=f.type==On.Text?f:null;p&&(t.lineWrapping||d.widgetLineBreaks)&&(p=xo(t,i,1,p));m&&(t.lineWrapping||f.widgetLineBreaks)&&(m=xo(t,r,-1,m));if(p&&m&&p.from==m.from&&p.to==m.to)return y(v(n.from,n.to,p));{let e=p?v(n.from,null,p):$(d,!1),i=m?v(null,n.to,m):$(f,!0),r=[];return(p||d).to<(m||f).from-(p&&m?1:0)||d.widgetLineBreaks>1&&e.bottom+t.defaultLineHeight/2c&&i.from=o)break;a>r&&l(Math.max(t,r),null==e&&t<=c,Math.min(a,o),null==n&&a>=O,s.dir)}if(r=i.to+1,r>=o)break}return 0==a.length&&l(c,null==e,O,null==n,t.textDirection),{top:r,bottom:s,horizontal:a}}function $(t,e){let n=a.top+(e?t.top:t.bottom);return{top:n,bottom:n,horizontal:[]}}}(t,e,n)}}function wo(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==bn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function xo(t,e,n,i){let r=t.coordsAtPos(e,2*n);if(!r)return i;let o=t.dom.getBoundingClientRect(),s=(r.top+r.bottom)/2,a=t.posAtCoords({x:o.left+1,y:s}),l=t.posAtCoords({x:o.right-1,y:s});return null==a||null==l?i:{from:Math.max(i.from,Math.min(a,l)),to:Math.min(i.to,Math.max(a,l))}}class Po{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(_o)!=t.state.facet(_o)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){!1!==this.layer.updateOnDocViewUpdate&&t.requestMeasure(this.measureReq)}setOrder(t){let e=0,n=t.facet(_o);for(;e{return n=t,i=this.drawn[e],!(n.constructor==i.constructor&&n.eq(i));var n,i}))){let e=this.dom.firstChild,n=0;for(let i of t)i.update&&e&&i.constructor&&this.drawn[n].constructor&&i.update(e,this.drawn[n])?(e=e.nextSibling,n++):this.dom.insertBefore(i.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const _o=U.define();function ko(t){return[li.define((e=>new Po(e,t))),_o.of(t)]}const To=U.define({combine:t=>Xt(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function Ro(t={}){return[To.of(t),zo,qo,Eo,Jn.of(!0)]}function Xo(t){return t.startState.facet(To)!=t.state.facet(To)}const zo=ko({above:!0,markers(t){let{state:e}=t,n=e.facet(To),i=[];for(let r of e.selection.ranges){let o=r==e.selection.main;if(r.empty||n.drawRangeCursor){let e=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=r.empty?r:W.cursor(r.head,r.head>r.anchor?-1:1);for(let r of bo.forRange(t,e,n))i.push(r)}}return i},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let n=Xo(t);return n&&Co(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Co(e.state,t)},class:"cm-cursorLayer"});function Co(t,e){e.style.animationDuration=t.facet(To).cursorBlinkRate+"ms"}const qo=ko({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:bo.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||Xo(t),class:"cm-selectionLayer"}),Eo=et.highest(ao.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Vo=yt.define({map:(t,e)=>null==t?null:e.mapPos(t)}),Zo=B.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(Vo)?e.value:t),t))}),Ao=li.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(Zo);null==n?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Zo)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(Zo),n=null!=e&&t.coordsAtPos(e);if(!n)return null;let i=t.scrollDOM.getBoundingClientRect();return{left:n.left-i.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-i.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Zo)!=t&&this.view.dispatch({effects:Vo.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Wo(t,e,n,i,r){e.lastIndex=0;for(let o,s=t.iterRange(n,i),a=n;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;o=e.exec(s.value);)r(a+o.index,o)}class Yo{constructor(t){const{regexp:e,decoration:n,decorate:i,boundary:r,maxLength:o=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,i)this.addMatch=(t,e,n,r)=>i(r,n,n+t[0].length,t,e);else if("function"==typeof n)this.addMatch=(t,e,i,r)=>{let o=n(t,e,i);o&&r(i,i+t[0].length,o)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,i,r)=>r(i,i+t[0].length,n)}this.boundary=r,this.maxLength=o}createDeco(t){let e=new Zt,n=e.add.bind(e);for(let{from:e,to:i}of function(t,e){let n=t.visibleRanges;if(1==n.length&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let i=[];for(let{from:r,to:o}of n)r=Math.max(t.state.doc.lineAt(r).from,r-e),o=Math.min(t.state.doc.lineAt(o).to,o+e),i.length&&i[i.length-1].to>=r?i[i.length-1].to=o:i.push({from:r,to:o});return i}(t,this.maxLength))Wo(t.state.doc,this.regexp,e,i,((e,i)=>this.addMatch(i,t,e,n)));return e.finish()}updateDeco(t,e){let n=1e9,i=-1;return t.docChanged&&t.changes.iterChanges(((e,r,o,s)=>{s>=t.view.viewport.from&&o<=t.view.viewport.to&&(n=Math.min(o,n),i=Math.max(s,i))})),t.viewportMoved||i-n>1e3?this.createDeco(t.view):i>-1?this.updateRange(t.view,e.map(t.changes),n,i):e}updateRange(t,e,n,i){for(let r of t.visibleRanges){let o=Math.max(r.from,n),s=Math.min(r.to,i);if(s>o){let n=t.state.doc.lineAt(o),i=n.ton.from;o--)if(this.boundary.test(n.text[o-1-n.from])){a=o;break}for(;sO.push(n.range(t,e));if(n==i)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.indexthis.addMatch(n,t,e,h)));e=e.update({filterFrom:a,filterTo:l,filter:(t,e)=>tl,add:O})}}return e}}const Do=null!=/x/.unicode?"gu":"g",Uo=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Do),Mo={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let jo=null;const Lo=U.define({combine(t){let e=Xt(t,{render:null,specialChars:Uo,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==jo&&"undefined"!=typeof document&&document.body){let e=document.body.style;jo=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return jo||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Do)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Do)),e}});function Io(t={}){return[Lo.of(t),No||(No=li.fromClass(class{constructor(t){this.view=t,this.decorations=hn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Lo)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Yo({regexp:t.specialChars,decoration:(e,n,i)=>{let{doc:r}=n.state,o=x(e[0],0);if(9==o){let t=r.lineAt(i),e=n.state.tabSize,o=Gt(t.text,e,i-t.from);return hn.replace({widget:new Bo((e-o%e)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=hn.replace({widget:new Go(t,o)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Lo);t.startState.facet(Lo)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let No=null;class Go extends cn{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),n=t.state.phrase("Control character")+" "+(Mo[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,e);if(i)return i;let r=document.createElement("span");return r.textContent=e,r.title=n,r.setAttribute("aria-label",n),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Bo extends cn{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}const Fo=hn.line({class:"cm-activeLine"}),Ho=li.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let i of t.state.selection.ranges){let r=t.lineBlockAt(i.head);r.from>e&&(n.push(Fo.range(r.from)),e=r.from)}return hn.set(n)}},{decorations:t=>t.decorations});class Ko extends cn{constructor(t){super(),this.content=t}toDOM(t){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(t):this.content.cloneNode(!0)),"string"==typeof this.content?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(t){let e=t.firstChild?he(t.firstChild):[];if(!e.length)return null;let n=window.getComputedStyle(t.parentNode),i=ge(e[0],"rtl"!=n.direction),r=parseInt(n.lineHeight);return i.bottom-i.top>1.5*r?{left:i.left,right:i.right,top:i.top,bottom:i.top+r}:i}ignoreEvent(){return!1}}const Jo=2e3;function ts(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),i=t.state.doc.lineAt(n),r=n-i.from,o=r>Jo?-1:r==i.length?function(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}(t,e.clientX):Gt(i.text,t.state.tabSize,n-i.from);return{line:i.number,col:o,off:r}}function es(t,e){let n=ts(t,e),i=t.state.selection;return n?{update(t){if(t.docChanged){let e=t.changes.mapPos(t.startState.doc.line(n.line).from),r=t.state.doc.lineAt(e);n={line:r.number,col:n.col,off:Math.min(n.off,r.length)},i=i.map(t.changes)}},get(e,r,o){let s=ts(t,e);if(!s)return i;let a=function(t,e,n){let i=Math.min(e.line,n.line),r=Math.max(e.line,n.line),o=[];if(e.off>Jo||n.off>Jo||e.col<0||n.col<0){let s=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let e=i;e<=r;e++){let n=t.doc.line(e);n.length<=a&&o.push(W.range(n.from+s,n.to+a))}}else{let s=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let e=i;e<=r;e++){let n=t.doc.line(e),i=Bt(n.text,s,t.tabSize,!0);if(i<0)o.push(W.cursor(n.to));else{let e=Bt(n.text,a,t.tabSize);o.push(W.range(n.from+i,n.from+e))}}}return o}(t.state,n,s);return a.length?o?W.create(a.concat(i.ranges)):W.create(a):i}}:null}function ns(t){let e=(null==t?void 0:t.eventFilter)||(t=>t.altKey&&0==t.button);return ao.mouseSelectionStyle.of(((t,n)=>e(n)?es(t,n):null))}const is={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},rs={style:"cursor: crosshair"};function os(t={}){let[e,n]=is[t.key||"Alt"],i=li.fromClass(class{constructor(t){this.view=t,this.isDown=!1}set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]))}},{eventObservers:{keydown(t){this.set(t.keyCode==e||n(t))},keyup(t){t.keyCode!=e&&n(t)||this.set(!1)},mousemove(t){this.set(n(t))}}});return[i,ao.contentAttributes.of((t=>{var e;return(null===(e=t.plugin(i))||void 0===e?void 0:e.isDown)?rs:null}))]}const ss="-10000px";class as{constructor(t,e,n,i){this.facet=e,this.createTooltipView=n,this.removeTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t));let r=null;this.tooltipViews=this.tooltips.map((t=>r=n(t,r)))}update(t,e){var n;let i=t.state.facet(this.facet),r=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let o=[],s=e?[]:null;for(let n=0;ne[n]=t)),e.length=s.length),this.input=i,this.tooltips=r,this.tooltipViews=o,!0}}function ls(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const cs=U.define({combine:t=>{var e,n,i;return{position:Ge.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(n=t.find((t=>t.parent)))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=t.find((t=>t.tooltipSpace)))||void 0===i?void 0:i.tooltipSpace)||ls}}}),Os=new WeakMap,hs=li.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(cs);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver((()=>this.measureSoon())):null,this.manager=new as(t,ps,((t,e)=>this.createTooltip(t,e)),(t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()})),this.above=this.manager.tooltips.map((t=>!!t.above)),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,i=t.state.facet(cs);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),i=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",n.dom.appendChild(t)}return n.dom.style.position=this.position,n.dom.style.top=ss,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:t}=this.manager.tooltipViews[0];if(Ge.gecko)n=t.offsetParent!=this.container.ownerDocument.body;else if(t.style.top==ss&&"0px"==t.style.left){let e=t.getBoundingClientRect();n=Math.abs(e.top+1e4)>1||Math.abs(e.left)>1}}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(t=n.width/this.parent.offsetWidth,e=n.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=yi(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map(((t,e)=>{let n=this.manager.tooltipViews[e];return n.getCoords?n.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(cs).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let t of this.manager.tooltipViews)t.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:o}=t,s=[];for(let a=0;a=Math.min(n.bottom,i.bottom)||h.rightMath.min(n.right,i.right)+.1)){O.style.top=ss;continue}let d=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,f=d?7:0,p=u.right-u.left,m=null!==(e=Os.get(c))&&void 0!==e?e:u.bottom-u.top,g=c.offset||fs,y=this.view.textDirection==bn.LTR,v=u.width>i.right-i.left?y?i.left:i.right-u.width:y?Math.max(i.left,Math.min(h.left-(d?14:0)+g.x,i.right-p)):Math.min(Math.max(i.left,h.left-p+(d?14:0)-g.x),i.right-p),$=this.above[a];!l.strictSide&&($?h.top-m-f-g.yi.bottom)&&$==i.bottom-h.bottom>h.top-i.top&&($=this.above[a]=!$);let Q=($?h.top-i.top:i.bottom-h.bottom)-f;if(Qv&&t.topS&&(S=$?t.top-m-2-f:t.bottom+f+2);if("absolute"==this.position?(O.style.top=(S-t.parent.top)/o+"px",us(O,(v-t.parent.left)/r)):(O.style.top=S/o+"px",us(O,v/r)),d){let t=h.left+(y?g.x:-g.x)-(v+14-7);d.style.left=t/r+"px"}!0!==c.overlap&&s.push({left:v,top:S,right:b,bottom:S+m}),O.classList.toggle("cm-tooltip-above",$),O.classList.toggle("cm-tooltip-below",!$),c.positioned&&c.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=ss}},{eventObservers:{scroll(){this.maybeMeasure()}}});function us(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const ds=ao.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),fs={x:0,y:0},ps=U.define({enables:[hs,ds]}),ms=U.define({combine:t=>t.reduce(((t,e)=>t.concat(e)),[])});class gs{static create(t){return new gs(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new as(t,ms,((t,e)=>this.createHostedView(t,e)),(t=>t.dom.remove()))}createHostedView(t,e){let n=t.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)null===(t=e.destroy)||void 0===t||t.call(e)}passProp(t){let e;for(let n of this.manager.tooltipViews){let i=n[t];if(void 0!==i)if(void 0===e)e=i;else if(e!==i)return}return e}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const ys=ps.compute([ms],(t=>{let e=t.facet(ms);return 0===e.length?null:{pos:Math.min(...e.map((t=>t.pos))),end:Math.max(...e.map((t=>{var e;return null!==(e=t.end)&&void 0!==e?e:t.pos}))),create:gs.create,above:e[0].above,arrow:e.some((t=>t.arrow))}}));class vs{constructor(t,e,n,i,r){this.view=t,this.source=e,this.field=n,this.setHover=i,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((()=>this.startHover()),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;tn.bottom||e.xn.right+t.defaultCharacterWidth)return;let o=t.bidiSpans(t.state.doc.lineAt(i)).find((t=>t.from<=i&&t.to>=i)),s=o&&o.dir==bn.RTL?-1:1;r=e.x{this.pending==e&&(this.pending=null,!n||Array.isArray(n)&&!n.length||t.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))}),(e=>ri(t.state,e,"hover tooltip")))}else!o||Array.isArray(o)&&!o.length||t.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let t=this.view.plugin(hs),e=t?t.manager.tooltips.findIndex((t=>t.create==gs.create)):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,n;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:r}=this;if(i.length&&r&&!function(t,e){let n,{left:i,right:r,top:o,bottom:s}=t.getBoundingClientRect();if(n=t.querySelector(".cm-tooltip-arrow")){let t=n.getBoundingClientRect();o=Math.min(t.top,o),s=Math.max(t.bottom,s)}return e.clientX>=i-$s&&e.clientX<=r+$s&&e.clientY>=o-$s&&e.clientY<=s+$s}(r.dom,t)||this.pending){let{pos:r}=i[0]||this.pending,o=null!==(n=null===(e=i[0])||void 0===e?void 0:e.end)&&void 0!==n?n:r;(r==o?this.view.posAtCoords(this.lastMove)==r:function(t,e,n,i,r){let o=t.scrollDOM.getBoundingClientRect(),s=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>i||o.rightr||Math.min(o.bottom,s)=e&&a<=n}(this.view,r,o,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:e}=this;e&&e.dom.contains(t.relatedTarget)?this.watchTooltipLeave(e.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=n=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const $s=4;function Qs(t,e={}){let n=yt.define(),i=B.define({create:()=>[],update(t,i){if(t.length&&(e.hideOnChange&&(i.docChanged||i.selection)?t=[]:e.hideOn&&(t=t.filter((t=>!e.hideOn(i,t)))),i.docChanged)){let e=[];for(let n of t){let t=i.changes.mapPos(n.pos,-1,T.TrackDel);if(null!=t){let r=Object.assign(Object.create(null),n);r.pos=t,null!=r.end&&(r.end=i.changes.mapPos(r.end)),e.push(r)}}t=e}for(let e of i.effects)e.is(n)&&(t=e.value),e.is(bs)&&(t=[]);return t},provide:t=>ms.from(t)});return{active:i,extension:[i,li.define((r=>new vs(r,t,i,n,e.hoverTime||300))),ys]}}function Ss(t,e){let n=t.plugin(hs);if(!n)return null;let i=n.manager.tooltips.indexOf(e);return i<0?null:n.manager.tooltipViews[i]}const bs=yt.define();const ws=U.define({combine(t){let e,n;for(let i of t)e=e||i.topContainer,n=n||i.bottomContainer;return{topContainer:e,bottomContainer:n}}});function xs(t,e){let n=t.plugin(Ps),i=n?n.specs.indexOf(e):-1;return i>-1?n.panels[i]:null}const Ps=li.fromClass(class{constructor(t){this.input=t.state.facet(Ts),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(ws);this.top=new _s(t,!0,e.topContainer),this.bottom=new _s(t,!1,e.bottomContainer),this.top.sync(this.panels.filter((t=>t.top))),this.bottom.sync(this.panels.filter((t=>!t.top)));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(ws);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new _s(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new _s(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Ts);if(n!=this.input){let e=n.filter((t=>t)),i=[],r=[],o=[],s=[];for(let n of e){let e,a=this.specs.indexOf(n);a<0?(e=n(t.view),s.push(e)):(e=this.panels[a],e.update&&e.update(t)),i.push(e),(e.top?r:o).push(e)}this.specs=e,this.panels=i,this.top.sync(r),this.bottom.sync(o);for(let t of s)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>ao.scrollMargins.of((e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))});class _s{constructor(t,e,n){this.view=t,this.top=e,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=ks(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=ks(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function ks(t){let e=t.nextSibling;return t.remove(),e}const Ts=U.define({enables:Ps});class Rs extends zt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Rs.prototype.elementClass="",Rs.prototype.toDOM=void 0,Rs.prototype.mapMode=T.TrackBefore,Rs.prototype.startSide=Rs.prototype.endSide=-1,Rs.prototype.point=!0;const Xs=U.define(),zs=U.define(),Cs={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Vt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},qs=U.define();function Es(t){return[Zs(),qs.of(Object.assign(Object.assign({},Cs),t))]}const Vs=U.define({combine:t=>t.some((t=>t))});function Zs(t){let e=[As];return t&&!1===t.fixed&&e.push(Vs.of(!0)),e}const As=li.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(qs).map((e=>new Us(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Vs),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,i=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(Vs)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let n=Vt.iter(this.view.state.facet(Xs),this.view.viewport.from),i=[],r=this.gutters.map((t=>new Ds(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(t.type)){let e=!0;for(let o of t.type)if(o.type==On.Text&&e){Ys(n,i,o.from);for(let t of r)t.line(this.view,o,i);e=!1}else if(o.widget)for(let t of r)t.widget(this.view,o)}else if(t.type==On.Text){Ys(n,i,t.from);for(let e of r)e.line(this.view,t,i)}else if(t.widget)for(let e of r)e.widget(this.view,t);for(let t of r)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(qs),n=t.state.facet(qs),i=t.docChanged||t.heightChanged||t.viewportChanged||!Vt.eq(t.startState.facet(Xs),t.state.facet(Xs),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let e of this.gutters)e.update(t)&&(i=!0);else{i=!0;let r=[];for(let i of n){let n=e.indexOf(i);n<0?r.push(new Us(this.view,i)):(this.gutters[n].update(t),r.push(this.gutters[n]))}for(let t of this.gutters)t.dom.remove(),r.indexOf(t)<0&&t.destroy();for(let t of r)this.dom.appendChild(t.dom);this.gutters=r}return i}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>ao.scrollMargins.of((e=>{let n=e.plugin(t);return n&&0!=n.gutters.length&&n.fixed?e.textDirection==bn.LTR?{left:n.dom.offsetWidth*e.scaleX}:{right:n.dom.offsetWidth*e.scaleX}:null}))});function Ws(t){return Array.isArray(t)?t:[t]}function Ys(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class Ds{constructor(t,e,n){this.gutter=t,this.height=n,this.i=0,this.cursor=Vt.iter(t.markers,e.from)}addElement(t,e,n){let{gutter:i}=this,r=(e.top-this.height)/t.scaleY,o=e.height/t.scaleY;if(this.i==i.elements.length){let e=new Ms(t,o,r,n);i.elements.push(e),i.dom.appendChild(e.dom)}else i.elements[this.i].update(t,o,r,n);this.height=e.bottom,this.i++}line(t,e,n){let i=[];Ys(this.cursor,i,e.from),n.length&&(i=i.concat(n));let r=this.gutter.config.lineMarker(t,e,i);r&&i.unshift(r);let o=this.gutter;(0!=i.length||o.config.renderEmptyElements)&&this.addElement(t,e,i)}widget(t,e){let n=this.gutter.config.widgetMarker(t,e.widget,e),i=n?[n]:null;for(let n of t.state.facet(zs)){let r=n(t,e.widget,e);r&&(i||(i=[])).push(r)}i&&this.addElement(t,e,i)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class Us{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in e.domEventHandlers)this.dom.addEventListener(n,(i=>{let r,o=i.target;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let t=o.getBoundingClientRect();r=(t.top+t.bottom)/2}else r=i.clientY;let s=t.lineBlockAtHeight(r-t.documentTop);e.domEventHandlers[n](t,s,i)&&i.preventDefault()}));this.markers=Ws(e.markers(t)),e.initialSpacer&&(this.spacer=new Ms(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=Ws(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let e=this.config.updateSpacer(this.spacer.markers[0],t);e!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[e])}let n=t.view.viewport;return!Vt.eq(this.markers,e,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class Ms{constructor(t,e,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,n,i)}update(t,e,n,i){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let n=0;nXt(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let n=Object.assign({},t);for(let t in e){let i=n[t],r=e[t];n[t]=i?(t,e,n)=>i(t,e,n)||r(t,e,n):r}return n}})});class Ns extends Rs{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function Gs(t,e){return t.state.facet(Is).formatNumber(e,t.state)}const Bs=qs.compute([Is],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(js),lineMarker:(t,e,n)=>n.some((t=>t.toDOM))?null:new Ns(Gs(t,t.state.doc.lineAt(e.from).number)),widgetMarker:(t,e,n)=>{for(let i of t.state.facet(Ls)){let r=i(t,e,n);if(r)return r}return null},lineMarkerChange:t=>t.startState.facet(Is)!=t.state.facet(Is),initialSpacer:t=>new Ns(Gs(t,Hs(t.state.doc.lines))),updateSpacer(t,e){let n=Gs(e.view,Hs(e.view.state.doc.lines));return n==t.number?t:new Ns(n)},domEventHandlers:t.facet(Is).domEventHandlers})));function Fs(t={}){return[Is.of(t),Zs(),Bs]}function Hs(t){let e=9;for(;e{let e=[],n=-1;for(let i of t.selection.ranges){let r=t.doc.lineAt(i.head).from;r>n&&(n=r,e.push(Ks.range(r)))}return Vt.of(e)}));const ta=1024;let ea=0;class na{constructor(t,e){this.from=t,this.to=e}}class ia{constructor(t={}){this.id=ea++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=sa.match(t)),e=>{let n=t(e);return void 0===n?null:[this,n]}}}ia.closedBy=new ia({deserialize:t=>t.split(" ")}),ia.openedBy=new ia({deserialize:t=>t.split(" ")}),ia.group=new ia({deserialize:t=>t.split(" ")}),ia.isolate=new ia({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),ia.contextHash=new ia({perNode:!0}),ia.lookAhead=new ia({perNode:!0}),ia.mounted=new ia({perNode:!0});class ra{constructor(t,e,n){this.tree=t,this.overlay=e,this.parser=n}static get(t){return t&&t.props&&t.props[ia.mounted.id]}}const oa=Object.create(null);class sa{constructor(t,e,n,i=0){this.name=t,this.props=e,this.id=n,this.flags=i}static define(t){let e=t.props&&t.props.length?Object.create(null):oa,n=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),i=new sa(t.name||"",e,t.id,n);if(t.props)for(let n of t.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[n[0].id]=n[1]}return i}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(ia.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let n in t)for(let i of n.split(" "))e[i]=t[n];return t=>{for(let n=t.prop(ia.group),i=-1;i<(n?n.length:0);i++){let r=e[i<0?t.name:n[i]];if(r)return r}}}}sa.none=new sa("",Object.create(null),0,8);class aa{constructor(t){this.types=t;for(let e=0;e=e){let s=new ga(o.tree,o.overlay[0].from+t.from,-1,t);(r||(r=[i])).push(pa(s,e,n,!1))}}return r?Sa(r):i}(this,t,e)}iterate(t){let{enter:e,leave:n,from:i=0,to:r=this.length}=t,o=t.mode||0,s=(o&Oa.IncludeAnonymous)>0;for(let t=this.cursor(o|Oa.IncludeAnonymous);;){let o=!1;if(t.from<=r&&t.to>=i&&(!s&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;o=!0}for(;o&&n&&(s||!t.type.isAnonymous)&&n(t),!t.nextSibling();){if(!t.parent())return;o=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:ka(sa.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,n)=>new ha(this.type,t,e,n,this.propValues)),t.makeTree||((t,e,n)=>new ha(sa.none,t,e,n)))}static build(t){return function(t){var e;let{buffer:n,nodeSet:i,maxBufferLength:r=ta,reused:o=[],minRepeatType:s=i.types.length}=t,a=Array.isArray(n)?new ua(n,n.length):n,l=i.types,c=0,O=0;function h(t,e,n,y,v,$){let{id:Q,start:S,end:b,size:w}=a,x=O,P=c;for(;w<0;){if(a.next(),-1==w){let e=o[Q];return n.push(e),void y.push(S-t)}if(-3==w)return void(c=Q);if(-4==w)return void(O=Q);throw new RangeError(`Unrecognized record size: ${w}`)}let _,k,T=l[Q],R=S-t;if(b-S<=r&&(k=m(a.pos-e,v))){let e=new Uint16Array(k.size-k.skip),n=a.pos-k.size,r=e.length;for(;a.pos>n;)r=g(k.start,e,r);_=new da(e,b-k.start,i),R=k.start-t}else{let t=a.pos-w;a.next();let e=[],n=[],i=Q>=s?Q:-1,o=0,l=b;for(;a.pos>t;)i>=0&&a.id==i&&a.size>=0?(a.end<=l-r&&(f(e,n,S,o,a.end,l,i,x,P),o=e.length,l=a.end),a.next()):$>2500?u(S,t,e,n):h(S,t,e,n,i,$+1);if(i>=0&&o>0&&o-1&&o>0){let t=d(T,P);_=ka(T,e,n,0,e.length,0,b-S,t,t)}else _=p(T,e,n,b-S,x-b,P)}n.push(_),y.push(R)}function u(t,e,n,o){let s=[],l=0,c=-1;for(;a.pos>e;){let{id:t,start:e,end:n,size:i}=a;if(i>4)a.next();else{if(c>-1&&e=0;t-=3)e[n++]=s[t],e[n++]=s[t+1]-r,e[n++]=s[t+2]-r,e[n++]=n;n.push(new da(e,s[2]-r,i)),o.push(r-t)}}function d(t,e){return(n,i,r)=>{let o,s,a=0,l=n.length-1;if(l>=0&&(o=n[l])instanceof ha){if(!l&&o.type==t&&o.length==r)return o;(s=o.prop(ia.lookAhead))&&(a=i[l]+o.length+s)}return p(t,n,i,r,a,e)}}function f(t,e,n,r,o,s,a,l,c){let O=[],h=[];for(;t.length>r;)O.push(t.pop()),h.push(e.pop()+n-o);t.push(p(i.types[a],O,h,s-o,l-s,c)),e.push(o-n)}function p(t,e,n,i,r,o,s){if(o){let t=[ia.contextHash,o];s=s?[t].concat(s):[t]}if(r>25){let t=[ia.lookAhead,r];s=s?[t].concat(s):[t]}return new ha(t,e,n,i,s)}function m(t,e){let n=a.fork(),i=0,o=0,l=0,c=n.end-r,O={size:0,start:0,skip:0};t:for(let r=n.pos-t;n.pos>r;){let t=n.size;if(n.id==e&&t>=0){O.size=i,O.start=o,O.skip=l,l+=4,i+=4,n.next();continue}let a=n.pos-t;if(t<0||a=s?4:0,u=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size)break t;h+=4}else n.id>=s&&(h+=4);n.next()}o=u,i+=t,l+=h}return(e<0||i==t)&&(O.size=i,O.start=o,O.skip=l),O.size>4?O:void 0}function g(t,e,n){let{id:i,start:r,end:o,size:l}=a;if(a.next(),l>=0&&i4){let i=a.pos-(l-4);for(;a.pos>i;)n=g(t,e,n)}e[--n]=s,e[--n]=o-t,e[--n]=r-t,e[--n]=i}else-3==l?c=i:-4==l&&(O=i);return n}let y=[],v=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,y,v,-1,0);let $=null!==(e=t.length)&&void 0!==e?e:y.length?v[0]+y[0].length:0;return new ha(l[t.topID],y.reverse(),v.reverse(),$)}(t)}}ha.empty=new ha(sa.none,[],[],0);class ua{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ua(this.buffer,this.index)}}class da{constructor(t,e,n){this.buffer=t,this.length=e,this.set=n}get type(){return sa.none}toString(){let t=[];for(let e=0;e0));a=o[a+3]);return s}slice(t,e,n){let i=this.buffer,r=new Uint16Array(e-t),o=0;for(let s=t,a=0;s=e&&ne;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function pa(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?s.length:-1;t!=l;t+=e){let l=s[t],c=a[t]+o.from;if(fa(i,n,c,c+l.length))if(l instanceof da){if(r&Oa.ExcludeBuffers)continue;let s=l.findChild(0,l.buffer.length,e,n-c,i);if(s>-1)return new Qa(new $a(o,l,t,c),null,s)}else if(r&Oa.IncludeAnonymous||!l.type.isAnonymous||xa(l)){let s;if(!(r&Oa.IgnoreMounts)&&(s=ra.get(l))&&!s.overlay)return new ga(s.tree,c,t,o);let a=new ga(l,c,t,o);return r&Oa.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(e<0?l.children.length-1:0,e,n,i)}}if(r&Oa.IncludeAnonymous||!o.type.isAnonymous)return null;if(t=o.index>=0?o.index+e:e<0?-1:o._parent._tree.children.length,o=o._parent,!o)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,n=0){let i;if(!(n&Oa.IgnoreOverlays)&&(i=ra.get(this._tree))&&i.overlay){let n=t-this.from;for(let{from:t,to:r}of i.overlay)if((e>0?t<=n:t=n:r>n))return new ga(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,n)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ya(t,e,n,i){let r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=n)for(let t=!1;!t;)if(t=r.type.is(n),!r.nextSibling())return o;for(;;){if(null!=i&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return null==i?o:[]}}function va(t,e,n=e.length-1){for(let i=t;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}class $a{constructor(t,e,n,i){this.parent=t,this.buffer=e,this.index=n,this.start=i}}class Qa extends ma{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,n){super(),this.context=t,this._parent=e,this.index=n,this.type=t.buffer.set.types[t.buffer.buffer[n]]}child(t,e,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.context.start,n);return r<0?null:new Qa(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,n=0){if(n&Oa.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new Qa(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Qa(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Qa(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let o=n.buffer[this.index+1];t.push(n.slice(i,r,o)),e.push(0)}return new ha(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Sa(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||r.to0){if(this.index-1)for(let i=e+t,r=t<0?-1:n._tree.children.length;i!=r;i+=t){let t=n._tree.children[i];if(this.mode&Oa.IncludeAnonymous||t instanceof da||!t.type.isAnonymous||xa(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;e=o,n=r+1;break t}i=this.stack[--r]}for(let t=n;t=0;r--){if(r<0)return va(this._tree,t,i);let o=n[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}}function xa(t){return t.children.some((t=>t instanceof da||!t.type.isAnonymous||xa(t)))}const Pa=new WeakMap;function _a(t,e){if(!t.isAnonymous||e instanceof da||e.type!=t)return 1;let n=Pa.get(e);if(null==n){n=1;for(let i of e.children){if(i.type!=t||!(i instanceof ha)){n=1;break}n+=_a(t,i)}Pa.set(e,n)}return n}function ka(t,e,n,i,r,o,s,a,l){let c=0;for(let n=i;n=O)break;f+=e}if(c==r+1){if(f>O){let t=n[r];e(t.children,t.positions,0,t.children.length,i[r]+a);continue}h.push(n[r])}else{let e=i[c-1]+n[c-1].length-d;h.push(ka(t,n,i,r,c,d,e,null,l))}u.push(d+a-o)}}(e,n,i,r,0),(a||l)(h,u,s)}class Ta{constructor(){this.map=new WeakMap}setBuffer(t,e,n){let i=this.map.get(t);i||this.map.set(t,i=new Map),i.set(e,n)}getBuffer(t,e){let n=this.map.get(t);return n&&n.get(e)}set(t,e){t instanceof Qa?this.setBuffer(t.context.buffer,t.index,e):t instanceof ga&&this.map.set(t.tree,e)}get(t){return t instanceof Qa?this.getBuffer(t.context.buffer,t.index):t instanceof ga?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Ra{constructor(t,e,n,i,r=!1,o=!1){this.from=t,this.to=e,this.tree=n,this.offset=i,this.open=(r?1:0)|(o?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],n=!1){let i=[new Ra(0,t.length,t,0,!1,n)];for(let n of e)n.to>t.length&&i.push(n);return i}static applyChanges(t,e,n=128){if(!e.length)return t;let i=[],r=1,o=t.length?t[0]:null;for(let s=0,a=0,l=0;;s++){let c=s=n)for(;o&&o.from=e.from||O<=e.to||l){let t=Math.max(e.from,a)-l,n=Math.min(e.to,O)-l;e=t>=n?null:new Ra(t,n,e.tree,e.offset+l,s>0,!!c)}if(e&&i.push(e),o.to>O)break;o=rnew na(t.from,t.to))):[new na(0,0)]:[new na(0,t.length)],this.createParse(t,e||[],n)}parse(t,e,n){let i=this.startParse(t,e,n);for(;;){let t=i.advance();if(t)return t}}}class za{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}function Ca(t){return(e,n,i,r)=>new Aa(e,t,n,i,r)}class qa{constructor(t,e,n,i,r){this.parser=t,this.parse=e,this.overlay=n,this.target=i,this.from=r}}function Ea(t){if(!t.length||t.some((t=>t.from>=t.to)))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class Va{constructor(t,e,n,i,r,o,s){this.parser=t,this.predicate=e,this.mounts=n,this.index=i,this.start=r,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}}const Za=new ia({perNode:!0});class Aa{constructor(t,e,n,i,r){this.nest=e,this.input=n,this.fragments=i,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let t=this.baseParse.advance();if(!t)return null;if(this.baseParse=null,this.baseTree=t,this.startInner(),null!=this.stoppedAt)for(let t of this.inner)t.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let t=this.baseTree;return null!=this.stoppedAt&&(t=new ha(t.type,t.children,t.positions,t.length,t.propValues.concat([[Za,this.stoppedAt]]))),t}let t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;let n=Object.assign(Object.create(null),t.target.props);n[ia.mounted.id]=new ra(e,t.overlay,t.parser),t.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let e=this.innerDone;e=this.stoppedAt)a=!1;else if(t.hasNode(i)){if(e){let t=e.mounts.find((t=>t.frag.from<=i.from&&t.frag.to>=i.to&&t.mount.overlay));if(t)for(let n of t.mount.overlay){let r=n.from+t.pos,o=n.to+t.pos;r>=i.from&&o<=i.to&&!e.ranges.some((t=>t.fromr))&&e.ranges.push({from:r,to:o})}}a=!1}else if(n&&(o=Wa(n.ranges,i.from,i.to)))a=2!=o;else if(!i.type.isAnonymous&&(r=this.nest(i,this.input))&&(i.fromnew na(t.from-i.from,t.to-i.from))):null,i.tree,t.length?t[0].from:i.from)),r.overlay?t.length&&(n={ranges:t,depth:0,prev:n}):a=!1}}else if(e&&(s=e.predicate(i))&&(!0===s&&(s=new na(i.from,i.to)),s.from=0&&e.ranges[t].to==s.from?e.ranges[t]={from:e.ranges[t].from,to:s.to}:e.ranges.push(s)}if(a&&i.firstChild())e&&e.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break t;if(e&&! --e.depth){let t=ja(this.ranges,e.ranges);t.length&&(Ea(t),this.inner.splice(e.index,0,new qa(e.parser,e.parser.startParse(this.input,Ia(e.mounts,t),t),e.ranges.map((t=>new na(t.from-e.start,t.to-e.start))),e.target,t[0].from))),e=e.prev}n&&! --n.depth&&(n=n.prev)}}}}function Wa(t,e,n){for(let i of t){if(i.from>=n)break;if(i.to>e)return i.from<=e&&i.to>=n?2:1}return 0}function Ya(t,e,n,i,r,o){if(e=t&&e.enter(n,1,Oa.IgnoreOverlays|Oa.ExcludeBuffers)||e.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let e=this.cursor.tree;;){if(e==t.tree)return!0;if(!(e.children.length&&0==e.positions[0]&&e.children[0]instanceof ha))break;e=e.children[0]}return!1}}class Ma{constructor(t){var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let n=this.curFrag=t[0];this.curTo=null!==(e=n.tree.prop(Za))&&void 0!==e?e:n.to,this.inner=new Ua(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=e.tree.prop(Za))&&void 0!==t?t:e.to,this.inner=new Ua(e.tree,-e.offset)}}findMounts(t,e){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let t=this.inner.cursor.node;t;t=t.parent){let r=null===(n=t.tree)||void 0===n?void 0:n.prop(ia.mounted);if(r&&r.parser==e)for(let e=this.fragI;e=t.to)break;n.tree==this.curFrag.tree&&i.push({frag:n,pos:t.from-n.offset,mount:r})}}}return i}}function ja(t,e){let n=null,i=e;for(let r=1,o=0;r=a)break;t.to<=s||(n||(i=n=e.slice()),t.froma&&n.splice(o+1,0,new na(a,t.to))):t.to>a?n[o--]=new na(a,t.to):n.splice(o--,1))}}return i}function La(t,e,n,i){let r=0,o=0,s=!1,a=!1,l=-1e9,c=[];for(;;){let O=r==t.length?1e9:s?t[r].to:t[r].from,h=o==e.length?1e9:a?e[o].to:e[o].from;if(s!=a){let t=Math.max(l,n),e=Math.min(O,h,i);tnew na(t.from+i,t.to+i))),a,l);for(let e=0,i=a;;e++){let a=e==s.length,c=a?l:s[e].from;if(c>i&&n.push(new Ra(i,c,r.tree,-t,o.from>=i||o.openStart,o.to<=c||o.openEnd)),a)break;i=s[e].to}}else n.push(new Ra(a,l,r.tree,-t,o.from>=t||o.openStart,o.to<=s||o.openEnd))}return n}let Na=0;class Ga{constructor(t,e,n,i){this.name=t,this.set=e,this.base=n,this.modified=i,this.id=Na++}toString(){let{name:t}=this;for(let e of this.modified)e.name&&(t=`${e.name}(${t})`);return t}static define(t,e){let n="string"==typeof t?t:"?";if(t instanceof Ga&&(e=t),null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");let i=new Ga(n,[],null,[]);if(i.set.push(i),e)for(let t of e.set)i.set.push(t);return i}static defineModifier(t){let e=new Fa(t);return t=>t.modified.indexOf(e)>-1?t:Fa.get(t.base||t,t.modified.concat(e).sort(((t,e)=>t.id-e.id)))}}let Ba=0;class Fa{constructor(t){this.name=t,this.instances=[],this.id=Ba++}static get(t,e){if(!e.length)return t;let n=e[0].instances.find((n=>{return n.base==t&&(i=e,r=n.modified,i.length==r.length&&i.every(((t,e)=>t==r[e])));var i,r}));if(n)return n;let i=[],r=new Ga(t.name,i,t,e);for(let t of e)t.instances.push(r);let o=function(t){let e=[[]];for(let n=0;ne.length-t.length))}(e);for(let e of t.set)if(!e.modified.length)for(let t of o)i.push(Fa.get(e,t));return r}}function Ha(t){let e=Object.create(null);for(let n in t){let i=t[n];Array.isArray(i)||(i=[i]);for(let t of n.split(" "))if(t){let n=[],r=2,o=t;for(let e=0;;){if("..."==o&&e>0&&e+3==t.length){r=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!i)throw new RangeError("Invalid path: "+t);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),e+=i[0].length,e==t.length)break;let s=t[e++];if(e==t.length&&"!"==s){r=0;break}if("/"!=s)throw new RangeError("Invalid path: "+t);o=t.slice(e)}let s=n.length-1,a=n[s];if(!a)throw new RangeError("Invalid path: "+t);let l=new Ja(i,r,s>0?n.slice(0,s):null);e[a]=l.sort(e[a])}}return Ka.add(e)}const Ka=new ia;class Ja{constructor(t,e,n,i){this.tags=t,this.mode=e,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth{let e=r;for(let i of t)for(let t of i.set){let i=n[t.id];if(i){e=e?e+" "+i:i;break}}return e},scope:i}}function el(t,e,n,i=0,r=t.length){let o=new nl(i,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),i,r,"",o.highlighters),o.flush(r)}Ja.empty=new Ja([],2,null);class nl{constructor(t,e,n){this.at=t,this.highlighters=e,this.span=n,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,n,i,r){let{type:o,from:s,to:a}=t;if(s>=n||a<=e)return;o.isTop&&(r=this.highlighters.filter((t=>!t.scope||t.scope(o))));let l=i,c=function(t){let e=t.type.prop(Ka);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||Ja.empty,O=function(t,e){let n=null;for(let i of t){let t=i.style(e);t&&(n=n?n+" "+t:t)}return n}(r,c.tags);if(O&&(l&&(l+=" "),l+=O,1==c.mode&&(i+=(i?" ":"")+O)),this.startSpan(Math.max(e,s),l),c.opaque)return;let h=t.tree&&t.tree.prop(ia.mounted);if(h&&h.overlay){let o=t.node.enter(h.overlay[0].from+s,1),c=this.highlighters.filter((t=>!t.scope||t.scope(h.tree.type))),O=t.firstChild();for(let u=0,d=s;;u++){let f=u=p)&&t.nextSibling()););if(!f||p>n)break;d=f.to+s,d>e&&(this.highlightRange(o.cursor(),Math.max(e,f.from+s),Math.min(n,d),"",c),this.startSpan(Math.min(n,d),l))}O&&t.parent()}else if(t.firstChild()){h&&(i="");do{if(!(t.to<=e)){if(t.from>=n)break;this.highlightRange(t,e,n,i,r),this.startSpan(Math.min(n,t.to),l)}}while(t.nextSibling());t.parent()}}}const il=Ga.define,rl=il(),ol=il(),sl=il(ol),al=il(ol),ll=il(),cl=il(ll),Ol=il(ll),hl=il(),ul=il(hl),dl=il(),fl=il(),pl=il(),ml=il(pl),gl=il(),yl={comment:rl,lineComment:il(rl),blockComment:il(rl),docComment:il(rl),name:ol,variableName:il(ol),typeName:sl,tagName:il(sl),propertyName:al,attributeName:il(al),className:il(ol),labelName:il(ol),namespace:il(ol),macroName:il(ol),literal:ll,string:cl,docString:il(cl),character:il(cl),attributeValue:il(cl),number:Ol,integer:il(Ol),float:il(Ol),bool:il(ll),regexp:il(ll),escape:il(ll),color:il(ll),url:il(ll),keyword:dl,self:il(dl),null:il(dl),atom:il(dl),unit:il(dl),modifier:il(dl),operatorKeyword:il(dl),controlKeyword:il(dl),definitionKeyword:il(dl),moduleKeyword:il(dl),operator:fl,derefOperator:il(fl),arithmeticOperator:il(fl),logicOperator:il(fl),bitwiseOperator:il(fl),compareOperator:il(fl),updateOperator:il(fl),definitionOperator:il(fl),typeOperator:il(fl),controlOperator:il(fl),punctuation:pl,separator:il(pl),bracket:ml,angleBracket:il(ml),squareBracket:il(ml),paren:il(ml),brace:il(ml),content:hl,heading:ul,heading1:il(ul),heading2:il(ul),heading3:il(ul),heading4:il(ul),heading5:il(ul),heading6:il(ul),contentSeparator:il(hl),list:il(hl),quote:il(hl),emphasis:il(hl),strong:il(hl),link:il(hl),monospace:il(hl),strikethrough:il(hl),inserted:il(),deleted:il(),changed:il(),invalid:il(),meta:gl,documentMeta:il(gl),annotation:il(gl),processingInstruction:il(gl),definition:Ga.defineModifier("definition"),constant:Ga.defineModifier("constant"),function:Ga.defineModifier("function"),standard:Ga.defineModifier("standard"),local:Ga.defineModifier("local"),special:Ga.defineModifier("special")};for(let t in yl){let e=yl[t];e instanceof Ga&&(e.name=t)}tl([{tag:yl.link,class:"tok-link"},{tag:yl.heading,class:"tok-heading"},{tag:yl.emphasis,class:"tok-emphasis"},{tag:yl.strong,class:"tok-strong"},{tag:yl.keyword,class:"tok-keyword"},{tag:yl.atom,class:"tok-atom"},{tag:yl.bool,class:"tok-bool"},{tag:yl.url,class:"tok-url"},{tag:yl.labelName,class:"tok-labelName"},{tag:yl.inserted,class:"tok-inserted"},{tag:yl.deleted,class:"tok-deleted"},{tag:yl.literal,class:"tok-literal"},{tag:yl.string,class:"tok-string"},{tag:yl.number,class:"tok-number"},{tag:[yl.regexp,yl.escape,yl.special(yl.string)],class:"tok-string2"},{tag:yl.variableName,class:"tok-variableName"},{tag:yl.local(yl.variableName),class:"tok-variableName tok-local"},{tag:yl.definition(yl.variableName),class:"tok-variableName tok-definition"},{tag:yl.special(yl.variableName),class:"tok-variableName2"},{tag:yl.definition(yl.propertyName),class:"tok-propertyName tok-definition"},{tag:yl.typeName,class:"tok-typeName"},{tag:yl.namespace,class:"tok-namespace"},{tag:yl.className,class:"tok-className"},{tag:yl.macroName,class:"tok-macroName"},{tag:yl.propertyName,class:"tok-propertyName"},{tag:yl.operator,class:"tok-operator"},{tag:yl.comment,class:"tok-comment"},{tag:yl.meta,class:"tok-meta"},{tag:yl.invalid,class:"tok-invalid"},{tag:yl.punctuation,class:"tok-punctuation"}]);var vl;const $l=new ia;function Ql(t){return U.define({combine:t?e=>e.concat(t):void 0})}const Sl=new ia;class bl{constructor(t,e,n=[],i=""){this.data=t,this.name=i,Rt.prototype.hasOwnProperty("tree")||Object.defineProperty(Rt.prototype,"tree",{get(){return Pl(this)}}),this.parser=e,this.extension=[El.of(this),Rt.languageData.of(((t,e,n)=>{let i=wl(t,e,n),r=i.type.prop($l);if(!r)return[];let o=t.facet(r),s=i.type.prop(Sl);if(s){let r=i.resolve(e-i.from,n);for(let e of s)if(e.test(r,t)){let n=t.facet(e.facet);return"replace"==e.type?n:n.concat(o)}}return o}))].concat(n)}isActiveAt(t,e,n=-1){return wl(t,e,n).type.prop($l)==this.data}findRegions(t){let e=t.facet(El);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let n=[],i=(t,e)=>{if(t.prop($l)==this.data)return void n.push({from:e,to:e+t.length});let r=t.prop(ia.mounted);if(r){if(r.tree.prop($l)==this.data){if(r.overlay)for(let t of r.overlay)n.push({from:t.from+e,to:t.to+e});else n.push({from:e,to:e+t.length});return}if(r.overlay){let t=n.length;if(i(r.tree,r.overlay[0].from+e),n.length>t)return}}for(let n=0;nt.isTop?e:void 0))]}),t.name)}configure(t,e){return new xl(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Pl(t){let e=t.field(bl.state,!1);return e?e.tree:ha.empty}class _l{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let n=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-n,e-n)}}let kl=null;class Tl{constructor(t,e,n=[],i,r,o,s,a){this.parser=t,this.state=e,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,n){return new Tl(t,e,[],ha.empty,0,n,[],null)}startParse(){return this.parser.startParse(new _l(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=ha.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext((()=>{for(;!(e=this.parse.advance()););})),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(Ra.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=kl;kl=this;try{return t()}finally{kl=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Rl(t,e.from,e.to);return t}changes(t,e){let{fragments:n,tree:i,treeLen:r,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges(((t,n,i,r)=>e.push({fromA:t,toA:n,fromB:i,toB:r}))),n=Ra.applyChanges(n,e),i=ha.empty,r=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);nt.from&&(this.fragments=Rl(this.fragments,n,i),this.skipped.splice(e--,1))}return!(this.skipped.length>=e)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends Xa{createParse(e,n,i){let r=i[0].from,o=i[i.length-1].to;return{parsedPos:r,advance(){let e=kl;if(e){for(let t of i)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=o,new ha(sa.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return kl}}function Rl(t,e,n){return Ra.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Xl{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),n=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,n)||e.takeTree(),new Xl(e)}static init(t){let e=Math.min(3e3,t.doc.length),n=Tl.create(t.facet(El).parser,t,{from:0,to:e});return n.work(20,e)||n.takeTree(),new Xl(n)}}bl.state=B.define({create:Xl.init,update(t,e){for(let t of e.effects)if(t.is(bl.setState))return t.value;return e.startState.facet(El)!=e.state.facet(El)?Xl.init(e.state):t.apply(e)}});let zl=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(zl=t=>{let e=-1,n=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Cl="undefined"!=typeof navigator&&(null===(vl=navigator.scheduling)||void 0===vl?void 0:vl.isInputPending)?()=>navigator.scheduling.isInputPending():null,ql=li.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(bl.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(bl.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=zl(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndi+1e3,a=r.context.work((()=>Cl&&Cl()||Date.now()>o),i+(s?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:bl.setState.of(new Xl(r.context))})),this.chunkBudget>0&&(!a||s)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>ri(this.view.state,t))).then((()=>this.workScheduled--)),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),El=U.define({combine:t=>t.length?t[0]:null,enables:t=>[bl.state,ql,ao.contentAttributes.compute([t],(e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}}))]});class Vl{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const Zl=U.define(),Al=U.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some((t=>t!=e[0])))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Wl(t){let e=t.facet(Al);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Yl(t,e){let n="",i=t.tabSize,r=t.facet(Al)[0];if("\t"==r){for(;e>=i;)n+="\t",e-=i;r=" "}for(let t=0;t=e?function(t,e,n){let i=e.resolveStack(n),r=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let t=[];for(let e=r;e&&(e.from!=i.node.from||e.type!=i.node.type);e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)i={node:t[e],next:i}}return jl(i,t,n)}(t,n,e):null}class Ul{constructor(t,e={}){this.state=t,this.options=e,this.unit=Wl(t)}lineAt(t,e=1){let n=this.state.doc.lineAt(t),{simulateBreak:i,simulateDoubleBreak:r}=this.options;return null!=i&&i>=n.from&&i<=n.to?r&&i==t?{text:"",from:t}:(e<0?i-1&&(r+=o-this.countColumn(n,n.search(/\S|$/))),r}countColumn(t,e=t.length){return Gt(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:n,from:i}=this.lineAt(t,e),r=this.options.overrideIndentation;if(r){let t=r(i);if(t>-1)return t}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ml=new ia;function jl(t,e,n){for(let i=t;i;i=i.next){let t=Ll(i.node);if(t)return t(Nl.create(e,n,i))}return 0}function Ll(t){let e=t.type.prop(Ml);if(e)return e;let n,i=t.firstChild;if(i&&(n=i.type.prop(ia.closedBy))){let e=t.lastChild,i=e&&n.indexOf(e.name)>-1;return t=>Fl(t,!0,1,void 0,i&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?Il:null}function Il(){return 0}class Nl extends Ul{constructor(t,e,n){super(t.state,t.options),this.base=t,this.pos=e,this.context=n}get node(){return this.context.node}static create(t,e,n){return new Nl(t,e,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let n=t.resolve(e.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Gl(n,t))break;e=this.state.doc.lineAt(n.from)}return this.lineIndent(e.from)}continue(){return jl(this.context.next,this.base,this.pos)}}function Gl(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function Bl({closing:t,align:e=!0,units:n=1}){return i=>Fl(i,e,n,t)}function Fl(t,e,n,i,r){let o=t.textAfter,s=o.match(/^\s*/)[0].length,a=i&&o.slice(s,s+i.length)==i||r==t.pos+s,l=e?function(t){let e=t.node,n=e.childAfter(e.from),i=e.lastChild;if(!n)return null;let r=t.options.simulateBreak,o=t.state.doc.lineAt(n.from),s=null==r||r<=o.from?o.to:Math.min(o.to,r);for(let t=n.to;;){let r=e.childAfter(t);if(!r||r==i)return null;if(!r.type.isSkipped){if(r.from>=s)return null;let t=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+t}}t=r.to}}(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}const Hl=t=>t.baseIndent;function Kl({except:t,units:e=1}={}){return n=>{let i=t&&t.test(n.textAfter);return n.baseIndent+(i?0:e*n.unit)}}const Jl=U.define(),tc=new ia;function ec(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(r&&s.from=e&&i.to>n&&(r=i)}}return r}(t,e,n)}function rc(t,e){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);return n>=i?void 0:{from:n,to:i}}const oc=yt.define({map:rc}),sc=yt.define({map:rc});function ac(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some((t=>t.from<=n&&t.to>=n))||e.push(t.lineBlockAt(n));return e}const lc=B.define({create:()=>hn.none,update(t,e){t=t.map(e.changes);for(let n of e.effects)if(n.is(oc)&&!Oc(t,n.value.from,n.value.to)){let{preparePlaceholder:i}=e.state.facet(pc),r=i?hn.replace({widget:new vc(i(e.state,n.value))}):yc;t=t.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(sc)&&(t=t.update({filter:(t,e)=>n.value.from!=t||n.value.to!=e,filterFrom:n.value.from,filterTo:n.value.to}));if(e.selection){let n=!1,{head:i}=e.selection.main;t.between(i,i,((t,e)=>{ti&&(n=!0)})),n&&(t=t.update({filterFrom:i,filterTo:i,filter:(t,e)=>e<=i||t>=i}))}return t},provide:t=>ao.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,((t,e)=>{n.push(t,e)})),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{(!r||r.from>t)&&(r={from:t,to:e})})),r}function Oc(t,e,n){let i=!1;return t.between(e,e,((t,r)=>{t==e&&r==n&&(i=!0)})),i}function hc(t,e){return t.field(lc,!1)?e:e.concat(yt.appendConfig.of(mc()))}function uc(t,e,n=!0){let i=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return ao.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${t.state.phrase("to")} ${r}.`)}const dc=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:t=>{for(let e of ac(t)){let n=ic(t.state,e.from,e.to);if(n)return t.dispatch({effects:hc(t.state,[oc.of(n),uc(t,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:t=>{if(!t.state.field(lc,!1))return!1;let e=[];for(let n of ac(t)){let i=cc(t.state,n.from,n.to);i&&e.push(sc.of(i),uc(t,i,!1))}return e.length&&t.dispatch({effects:e}),e.length>0}},{key:"Ctrl-Alt-[",run:t=>{let{state:e}=t,n=[];for(let i=0;i{let e=t.state.field(lc,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,((t,e)=>{n.push(sc.of({from:t,to:e}))})),t.dispatch({effects:n}),!0}}],fc={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},pc=U.define({combine:t=>Xt(t,fc)});function mc(t){let e=[lc,bc];return t&&e.push(pc.of(t)),e}function gc(t,e){let{state:n}=t,i=n.facet(pc),r=e=>{let n=t.lineBlockAt(t.posAtDOM(e.target)),i=cc(t.state,n.from,n.to);i&&t.dispatch({effects:sc.of(i)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,r,e);let o=document.createElement("span");return o.textContent=i.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o}const yc=hn.replace({widget:new class extends cn{toDOM(t){return gc(t,null)}}});class vc extends cn{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return gc(t,this.value)}}const $c={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Qc extends Rs{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}function Sc(t={}){let e=Object.assign(Object.assign({},$c),t),n=new Qc(e,!0),i=new Qc(e,!1),r=li.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(El)!=t.state.facet(El)||t.startState.field(lc,!1)!=t.state.field(lc,!1)||Pl(t.startState)!=Pl(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new Zt;for(let r of t.viewportLineBlocks){let o=cc(t.state,r.from,r.to)?i:ic(t.state,r.from,r.to)?n:null;o&&e.add(r.from,r.from,o)}return e.finish()}}),{domEventHandlers:o}=e;return[r,Es({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(r))||void 0===e?void 0:e.markers)||Vt.empty},initialSpacer:()=>new Qc(e,!1),domEventHandlers:Object.assign(Object.assign({},o),{click:(t,e,n)=>{if(o.click&&o.click(t,e,n))return!0;let i=cc(t.state,e.from,e.to);if(i)return t.dispatch({effects:sc.of(i)}),!0;let r=ic(t.state,e.from,e.to);return!!r&&(t.dispatch({effects:oc.of(r)}),!0)}})}),mc()]}const bc=ao.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class wc{constructor(t,e){let n;function i(t){let e=Jt.newName();return(n||(n=Object.create(null)))["."+e]=t,e}this.specs=t;const r="string"==typeof e.all?e.all:e.all?i(e.all):void 0,o=e.scope;this.scope=o instanceof bl?t=>t.prop($l)==o.data:o?t=>t==o:void 0,this.style=tl(t.map((t=>({tag:t.tag,class:t.class||i(Object.assign({},t,{tag:null}))}))),{all:r}).style,this.module=n?new Jt(n):null,this.themeType=e.themeType}static define(t,e){return new wc(t,e||{})}}const xc=U.define(),Pc=U.define({combine:t=>t.length?[t[0]]:null});function _c(t){let e=t.facet(xc);return e.length?e:t.facet(Pc)}function kc(t,e){let n,i=[Rc];return t instanceof wc&&(t.module&&i.push(ao.styleModule.of(t.module)),n=t.themeType),(null==e?void 0:e.fallback)?i.push(Pc.of(t)):n?i.push(xc.computeN([ao.darkTheme],(e=>e.facet(ao.darkTheme)==("dark"==n)?[t]:[]))):i.push(xc.of(t)),i}class Tc{constructor(t){this.markCache=Object.create(null),this.tree=Pl(t.state),this.decorations=this.buildDeco(t,_c(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=Pl(t.state),n=_c(t.state),i=n!=_c(t.startState),{viewport:r}=t.view,o=t.changes.mapPos(this.decoratedTo,1);e.length=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(e!=this.tree||t.viewportChanged||i)&&(this.tree=e,this.decorations=this.buildDeco(t.view,n),this.decoratedTo=r.to)}buildDeco(t,e){if(!e||!this.tree.length)return hn.none;let n=new Zt;for(let{from:i,to:r}of t.visibleRanges)el(this.tree,e,((t,e,i)=>{n.add(t,e,this.markCache[i]||(this.markCache[i]=hn.mark({class:i})))}),i,r);return n.finish()}}const Rc=et.high(li.fromClass(Tc,{decorations:t=>t.decorations})),Xc=wc.define([{tag:yl.meta,color:"#404740"},{tag:yl.link,textDecoration:"underline"},{tag:yl.heading,textDecoration:"underline",fontWeight:"bold"},{tag:yl.emphasis,fontStyle:"italic"},{tag:yl.strong,fontWeight:"bold"},{tag:yl.strikethrough,textDecoration:"line-through"},{tag:yl.keyword,color:"#708"},{tag:[yl.atom,yl.bool,yl.url,yl.contentSeparator,yl.labelName],color:"#219"},{tag:[yl.literal,yl.inserted],color:"#164"},{tag:[yl.string,yl.deleted],color:"#a11"},{tag:[yl.regexp,yl.escape,yl.special(yl.string)],color:"#e40"},{tag:yl.definition(yl.variableName),color:"#00f"},{tag:yl.local(yl.variableName),color:"#30a"},{tag:[yl.typeName,yl.namespace],color:"#085"},{tag:yl.className,color:"#167"},{tag:[yl.special(yl.variableName),yl.macroName],color:"#256"},{tag:yl.definition(yl.propertyName),color:"#00c"},{tag:yl.comment,color:"#940"},{tag:yl.invalid,color:"#f00"}]),zc=ao.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Cc="()[]{}",qc=U.define({combine:t=>Xt(t,{afterCursor:!0,brackets:Cc,maxScanDistance:1e4,renderMatch:Zc})}),Ec=hn.mark({class:"cm-matchingBracket"}),Vc=hn.mark({class:"cm-nonmatchingBracket"});function Zc(t){let e=[],n=t.matched?Ec:Vc;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const Ac=B.define({create:()=>hn.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],i=e.state.facet(qc);for(let t of e.state.selection.ranges){if(!t.empty)continue;let r=jc(e.state,t.head,-1,i)||t.head>0&&jc(e.state,t.head-1,1,i)||i.afterCursor&&(jc(e.state,t.head,1,i)||t.headao.decorations.from(t)}),Wc=[Ac,zc];function Yc(t={}){return[qc.of(t),Wc]}const Dc=new ia;function Uc(t,e,n){let i=t.prop(e<0?ia.openedBy:ia.closedBy);if(i)return i;if(1==t.name.length){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function Mc(t){let e=t.type.prop(Dc);return e?e(t.node):t}function jc(t,e,n,i={}){let r=i.maxScanDistance||1e4,o=i.brackets||Cc,s=Pl(t),a=s.resolveInner(e,n);for(let i=a;i;i=i.parent){let r=Uc(i.type,n,o);if(r&&i.from0?e>=s.from&&es.from&&e<=s.to))return Lc(t,e,n,i,s,r,o)}}return function(t,e,n,i,r,o,s){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},O=t.doc.iterRange(e,n>0?t.doc.length:0),h=0;for(let t=0;!O.next().done&&t<=o;){let o=O.value;n<0&&(t+=o.length);let a=e+t*n;for(let t=n>0?0:o.length-1,e=n>0?o.length:-1;t!=e;t+=n){let e=s.indexOf(o[t]);if(!(e<0||i.resolveInner(a+t,1).type!=r))if(e%2==0==n>0)h++;else{if(1==h)return{start:c,end:{from:a+t,to:a+t+1},matched:e>>1==l>>1};h--}}n>0&&(t+=o.length)}return O.done?{start:c,matched:!1}:null}(t,e,n,s,a.type,r,o)}function Lc(t,e,n,i,r,o,s){let a=i.parent,l={from:r.from,to:r.to},c=0,O=null==a?void 0:a.cursor();if(O&&(n<0?O.childBefore(i.from):O.childAfter(i.to)))do{if(n<0?O.to<=i.from:O.from>=i.to){if(0==c&&o.indexOf(O.type.name)>-1&&O.from-1||(Gc.push(t),console.warn(e))}function Kc(t,e){let n=[];for(let i of e.split(" ")){let e=[];for(let n of i.split(".")){let i=t[n]||yl[n];i?"function"==typeof i?e.length?e=e.map(i):Hc(n,`Modifier ${n} used at start of tag`):e.length?Hc(n,`Tag ${n} used as modifier`):e=Array.isArray(i)?i:[i]:Hc(n,`Unknown highlighting tag ${n}`)}for(let t of e)n.push(t)}if(!n.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+n.map((t=>t.id)),o=Bc[r];if(o)return o.id;let s=Bc[r]=sa.define({id:Nc.length,name:i,props:[Ha({[i]:n})]});return Nc.push(s),s.id}bn.RTL,bn.LTR;function Jc(t,e){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=t(e,n);return!!r&&(i(n.update(r)),!0)}}const tO=Jc(sO,0),eO=Jc(oO,0),nO=Jc(((t,e)=>oO(t,e,function(t){let e=[];for(let n of t.selection.ranges){let i=t.doc.lineAt(n.from),r=n.to<=i.to?i:t.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:t.doc.lineAt(n.to-1));let o=e.length-1;o>=0&&e[o].to>i.from?e[o].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}(e))),0);function iO(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const rO=50;function oO(t,e,n=e.selection.ranges){let i=n.map((t=>iO(e,t.from).block));if(!i.every((t=>t)))return null;let r=n.map(((t,n)=>function(t,{open:e,close:n},i,r){let o,s,a=t.sliceDoc(i-rO,i),l=t.sliceDoc(r,r+rO),c=/\s*$/.exec(a)[0].length,O=/^\s*/.exec(l)[0].length,h=a.length-c;if(a.slice(h-e.length,h)==e&&l.slice(O,O+n.length)==n)return{open:{pos:i-c,margin:c&&1},close:{pos:r+O,margin:O&&1}};r-i<=2*rO?o=s=t.sliceDoc(i,r):(o=t.sliceDoc(i,i+rO),s=t.sliceDoc(r-rO,r));let u=/^\s*/.exec(o)[0].length,d=/\s*$/.exec(s)[0].length,f=s.length-d-n.length;return o.slice(u,u+e.length)==e&&s.slice(f,f+n.length)==n?{open:{pos:i+u+e.length,margin:/\s/.test(o.charAt(u+e.length))?1:0},close:{pos:r-d-n.length,margin:/\s/.test(s.charAt(f-1))?1:0}}:null}(e,i[n],t.from,t.to)));if(2!=t&&!r.every((t=>t)))return{changes:e.changes(n.map(((t,e)=>r[e]?[]:[{from:t.from,insert:i[e].open+" "},{from:t.to,insert:" "+i[e].close}])))};if(1!=t&&r.some((t=>t))){let t=[];for(let e,n=0;nr&&(t==o||o>l.from)){r=l.from;let t=/^\s*/.exec(l.text)[0].length,e=t==l.length,n=l.text.slice(t,t+a.length)==a?t:-1;tt.comment<0&&(!t.empty||t.single)))){let t=[];for(let{line:e,token:n,indent:r,empty:o,single:s}of i)!s&&o||t.push({from:e.from+r,insert:n+" "});let n=e.changes(t);return{changes:n,selection:e.selection.map(n,1)}}if(1!=t&&i.some((t=>t.comment>=0))){let t=[];for(let{line:e,comment:n,token:r}of i)if(n>=0){let i=e.from+n,o=i+r.length;" "==e.text[o-e.from]&&o++,t.push({from:i,to:o})}return{changes:t}}return null}const aO=pt.define(),lO=pt.define(),cO=U.define(),OO=U.define({combine:t=>Xt(t,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(n,i)=>t(n,i)||e(n,i)})}),hO=B.define({create:()=>kO.empty,update(t,e){let n=e.state.facet(OO),i=e.annotation(aO);if(i){let r=yO.fromTransaction(e,i.selection),o=i.side,s=0==o?t.undone:t.done;return s=r?vO(s,s.length,n.minDepth,r):bO(s,e.startState.selection),new kO(0==o?i.rest:s,0==o?s:i.rest)}let r=e.annotation(lO);if("full"!=r&&"before"!=r||(t=t.isolate()),!1===e.annotation(vt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let o=yO.fromTransaction(e),s=e.annotation(vt.time),a=e.annotation(vt.userEvent);return o?t=t.addChanges(o,s,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,s,a,n.newGroupDelay)),"full"!=r&&"after"!=r||(t=t.isolate()),t},toJSON:t=>({done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}),fromJSON:t=>new kO(t.done.map(yO.fromJSON),t.undone.map(yO.fromJSON))});function uO(t={}){return[hO,OO.of(t),ao.domEventHandlers({beforeinput(t,e){let n="historyUndo"==t.inputType?fO:"historyRedo"==t.inputType?pO:null;return!!n&&(t.preventDefault(),n(e))}})]}function dO(t,e){return function({state:n,dispatch:i}){if(!e&&n.readOnly)return!1;let r=n.field(hO,!1);if(!r)return!1;let o=r.pop(t,n,e);return!!o&&(i(o),!0)}}const fO=dO(0,!1),pO=dO(1,!1),mO=dO(0,!0),gO=dO(1,!0);class yO{constructor(t,e,n,i,r){this.changes=t,this.effects=e,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(t){return new yO(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,n;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((t=>t.toJSON()))}}static fromJSON(t){return new yO(t.changes&&X.fromJSON(t.changes),[],t.mapped&&R.fromJSON(t.mapped),t.startSelection&&W.fromJSON(t.startSelection),t.selectionsAfter.map(W.fromJSON))}static fromTransaction(t,e){let n=QO;for(let e of t.startState.facet(cO)){let i=e(t);i.length&&(n=n.concat(i))}return!n.length&&t.changes.empty?null:new yO(t.changes.invert(t.startState.doc),n,void 0,e||t.startState.selection,QO)}static selection(t){return new yO(void 0,QO,void 0,void 0,t)}}function vO(t,e,n,i){let r=e+1>n+20?e-n-1:0,o=t.slice(r,e);return o.push(i),o}function $O(t,e){return t.length?e.length?t.concat(e):t:e}const QO=[],SO=200;function bO(t,e){if(t.length){let n=t[t.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-SO));return i.length&&i[i.length-1].eq(e)?t:(i.push(e),vO(t,t.length-1,1e9,n.setSelAfter(i)))}return[yO.selection([e])]}function wO(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function xO(t,e){if(!t.length)return t;let n=t.length,i=QO;for(;n;){let r=PO(t[n-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let e=t.slice(0,n);return e[n-1]=r,e}e=r.mapped,n--,i=r.selectionsAfter}return i.length?[yO.selection(i)]:QO}function PO(t,e,n){let i=$O(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):QO,n);if(!t.changes)return yO.selection(i);let r=t.changes.map(e),o=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(o):o;return new yO(r,yt.mapEffects(t.effects,e),s,t.startSelection.map(o),i)}const _O=/^(input\.type|delete)($|\.)/;class kO{constructor(t,e,n=0,i=void 0){this.done=t,this.undone=e,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new kO(this.done,this.undone):this}addChanges(t,e,n,i,r){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!n||_O.test(n))&&(!s.selectionsAfter.length&&e-this.prevTimen.push(t,e))),e.iterChangedRanges(((t,e,r,o)=>{for(let t=0;t=e&&r<=s&&(i=!0)}})),i}(s.changes,t.changes))||"input.type.compose"==n)?vO(o,o.length-1,i.minDepth,new yO(t.changes.compose(s.changes),$O(yt.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,QO)):vO(o,o.length,i.minDepth,t),new kO(o,QO,e,n)}addSelection(t,e,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:QO;return r.length>0&&e-this.prevTimet.empty!=s.ranges[e].empty)).length)?this:new kO(bO(this.done,t),this.undone,e,n);var o,s}addMapping(t){return new kO(xO(this.done,t),xO(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,n){let i=0==t?this.done:this.undone;if(0==i.length)return null;let r=i[i.length-1],o=r.selectionsAfter[0]||e.selection;if(n&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:aO.of({side:t,rest:wO(i),selection:o}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==i.length?QO:i.slice(0,i.length-1);return r.mapped&&(n=xO(n,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:aO.of({side:t,rest:n,selection:o}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}kO.empty=new kO(QO,QO);const TO=[{key:"Mod-z",run:fO,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:pO,preventDefault:!0},{linux:"Ctrl-Shift-z",run:pO,preventDefault:!0},{key:"Mod-u",run:mO,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:gO,preventDefault:!0}];function RO(t,e){return W.create(t.ranges.map(e),t.mainIndex)}function XO(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function zO({state:t,dispatch:e},n){let i=RO(t.selection,n);return!i.eq(t.selection,!0)&&(e(XO(t,i)),!0)}function CO(t,e){return W.cursor(e?t.to:t.from)}function qO(t,e){return zO(t,(n=>n.empty?t.moveByChar(n,e):CO(n,e)))}function EO(t){return t.textDirectionAt(t.state.selection.main.head)==bn.LTR}const VO=t=>qO(t,!EO(t)),ZO=t=>qO(t,EO(t));function AO(t,e){return zO(t,(n=>n.empty?t.moveByGroup(n,e):CO(n,e)))}"undefined"!=typeof Intl&&Intl.Segmenter;function WO(t,e,n){if(e.type.prop(n))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function YO(t,e,n){let i,r,o=Pl(t).resolveInner(e.head),s=n?ia.closedBy:ia.openedBy;for(let i=e.head;;){let e=n?o.childAfter(i):o.childBefore(i);if(!e)break;WO(t,e,s)?o=e:i=n?e.to:e.from}return r=o.type.prop(s)&&(i=n?jc(t,o.from,1):jc(t,o.to,-1))&&i.matched?n?i.end.to:i.end.from:n?o.to:o.from,W.cursor(r,n?-1:1)}function DO(t,e){return zO(t,(n=>{if(!n.empty)return CO(n,e);let i=t.moveVertically(n,e);return i.head!=n.head?i:t.moveToLineBoundary(n,e)}))}const UO=t=>DO(t,!1),MO=t=>DO(t,!0);function jO(t){let e,n=t.scrollDOM.clientHeightn.empty?t.moveVertically(n,e,i.height):CO(n,e)));if(o.eq(r.selection))return!1;if(i.selfScroll){let e=t.coordsAtPos(r.selection.main.head),s=t.scrollDOM.getBoundingClientRect(),a=s.top+i.marginTop,l=s.bottom-i.marginBottom;e&&e.top>a&&e.bottomLO(t,!1),NO=t=>LO(t,!0);function GO(t,e,n){let i=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,n);if(r.head==e.head&&r.head!=(n?i.to:i.from)&&(r=t.moveToLineBoundary(e,n,!1)),!n&&r.head==i.from&&i.length){let n=/^\s*/.exec(t.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&e.head!=i.from+n&&(r=W.cursor(i.from+n))}return r}function BO(t,e,n){let i=!1,r=RO(t.selection,(e=>{let r=jc(t,e.head,-1)||jc(t,e.head,1)||e.head>0&&jc(t,e.head-1,1)||e.head{let n=e(t);return W.range(t.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(t.state.selection)&&(t.dispatch(XO(t.state,n)),!0)}function HO(t,e){return FO(t,(n=>t.moveByChar(n,e)))}const KO=t=>HO(t,!EO(t)),JO=t=>HO(t,EO(t));function th(t,e){return FO(t,(n=>t.moveByGroup(n,e)))}function eh(t,e){return FO(t,(n=>t.moveVertically(n,e)))}const nh=t=>eh(t,!1),ih=t=>eh(t,!0);function rh(t,e){return FO(t,(n=>t.moveVertically(n,e,jO(t).height)))}const oh=t=>rh(t,!1),sh=t=>rh(t,!0),ah=({state:t,dispatch:e})=>(e(XO(t,{anchor:0})),!0),lh=({state:t,dispatch:e})=>(e(XO(t,{anchor:t.doc.length})),!0),ch=({state:t,dispatch:e})=>(e(XO(t,{anchor:t.selection.main.anchor,head:0})),!0),Oh=({state:t,dispatch:e})=>(e(XO(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function hh(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:i}=t,r=i.changeByRange((i=>{let{from:r,to:o}=i;if(r==o){let s=e(i);sr&&(n="delete.forward",s=uh(t,s,!0)),r=Math.min(r,s),o=Math.max(o,s)}else r=uh(t,r,!1),o=uh(t,o,!0);return r==o?{range:i}:{changes:{from:r,to:o},range:W.cursor(r,re(t))))i.between(e,e,((t,i)=>{te&&(e=n?i:t)}));return e}const dh=(t,e,n)=>hh(t,(i=>{let r,o,s=i.from,{state:a}=t,l=a.doc.lineAt(s);if(n&&!e&&s>l.from&&sdh(t,!1,!0),ph=t=>dh(t,!0,!1),mh=(t,e)=>hh(t,(n=>{let i=n.head,{state:r}=t,o=r.doc.lineAt(i),s=r.charCategorizer(i);for(let t=null;;){if(i==(e?o.to:o.from)){i==n.head&&o.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let a=w(o.text,i-o.from,e)+o.from,l=o.text.slice(Math.min(i,a)-o.from,Math.max(i,a)-o.from),c=s(l);if(null!=t&&c!=t)break;" "==l&&i==n.head||(t=c),i=a}return i})),gh=t=>mh(t,!1);function yh(t){let e=[],n=-1;for(let i of t.selection.ranges){let r=t.doc.lineAt(i.from),o=t.doc.lineAt(i.to);if(i.empty||i.to!=o.from||(o=t.doc.lineAt(i.to-1)),n>=r.number){let t=e[e.length-1];t.to=o.to,t.ranges.push(i)}else e.push({from:r.from,to:o.to,ranges:[i]});n=o.number+1}return e}function vh(t,e,n){if(t.readOnly)return!1;let i=[],r=[];for(let e of yh(t)){if(n?e.to==t.doc.length:0==e.from)continue;let o=t.doc.lineAt(n?e.to+1:e.from-1),s=o.length+1;if(n){i.push({from:e.to,to:o.to},{from:e.from,insert:o.text+t.lineBreak});for(let n of e.ranges)r.push(W.range(Math.min(t.doc.length,n.anchor+s),Math.min(t.doc.length,n.head+s)))}else{i.push({from:o.from,to:e.from},{from:e.to,insert:t.lineBreak+o.text});for(let t of e.ranges)r.push(W.range(t.anchor-s,t.head-s))}}return!!i.length&&(e(t.update({changes:i,scrollIntoView:!0,selection:W.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function $h(t,e,n){if(t.readOnly)return!1;let i=[];for(let e of yh(t))n?i.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):i.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});return e(t.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Qh=Sh(!1);function Sh(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let i=e.changeByRange((n=>{let{from:i,to:r}=n,o=e.doc.lineAt(i),s=!t&&i==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n,i=Pl(t).resolveInner(e),r=i.childBefore(e),o=i.childAfter(e);return r&&o&&r.to<=e&&o.from>=e&&(n=r.type.prop(ia.closedBy))&&n.indexOf(o.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(o.from).from&&!/\S/.test(t.sliceDoc(r.to,o.from))?{from:r.to,to:o.from}:null}(e,i);t&&(i=r=(r<=o.to?o:e.doc.lineAt(r)).to);let a=new Ul(e,{simulateBreak:i,simulateDoubleBreak:!!s}),l=Dl(a,i);for(null==l&&(l=Gt(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));ro.from&&i{let r=[];for(let o=i.from;o<=i.to;){let s=t.doc.lineAt(o);s.number>n&&(i.empty||i.to>s.from)&&(e(s,r,i),n=s.number),o=s.to+1}let o=t.changes(r);return{changes:r,range:W.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}}))}const wh=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(bh(t,((e,n)=>{n.push({from:e.from,insert:t.facet(Al)})})),{userEvent:"input.indent"})),!0),xh=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(bh(t,((e,n)=>{let i=/^\s*/.exec(e.text)[0];if(!i)return;let r=Gt(i,t.tabSize),o=0,s=Yl(t,Math.max(0,r-Wl(t)));for(;ozO(t,(e=>W.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>FO(t,(e=>W.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>zO(t,(e=>W.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>FO(t,(e=>W.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:ph},{key:"Ctrl-h",run:fh},{key:"Ctrl-k",run:t=>hh(t,(e=>{let n=t.lineBlockAt(e.head).to;return e.head{if(t.readOnly)return!1;let n=t.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:f.of(["",""])},range:W.cursor(t.from)})));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange((e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let n=e.from,i=t.doc.lineAt(n),r=n==i.from?n-1:w(i.text,n-i.from,!1)+i.from,o=n==i.to?n+1:w(i.text,n-i.from,!0)+i.from;return{changes:{from:r,to:o,insert:t.doc.slice(n,o).append(t.doc.slice(r,n))},range:W.cursor(o)}}));return!n.changes.empty&&(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:NO}],_h=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>zO(t,(e=>YO(t.state,e,!EO(t)))),shift:t=>FO(t,(e=>YO(t.state,e,!EO(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>zO(t,(e=>YO(t.state,e,EO(t)))),shift:t=>FO(t,(e=>YO(t.state,e,EO(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>vh(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>$h(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>vh(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>$h(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let n=t.selection,i=null;return n.ranges.length>1?i=W.create([n.main]):n.main.empty||(i=W.create([W.cursor(n.main.head)])),!!i&&(e(XO(t,i)),!0)}},{key:"Mod-Enter",run:Sh(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let n=yh(t).map((({from:e,to:n})=>W.range(e,Math.min(n+1,t.doc.length))));return e(t.update({selection:W.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let n=RO(t.selection,(e=>{let n=Pl(t),i=n.resolveStack(e.from,1);if(e.empty){let t=n.resolveStack(e.from,-1);t.node.from>=i.node.from&&t.node.to<=i.node.to&&(i=t)}for(let t=i;t;t=t.next){let{node:n}=t;if((n.from=e.to||n.to>e.to&&n.from<=e.from)&&t.next)return W.range(n.to,n.from)}return e}));return!n.eq(t.selection)&&(e(XO(t,n)),!0)},preventDefault:!0},{key:"Mod-[",run:xh},{key:"Mod-]",run:wh},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),i=new Ul(t,{overrideIndentation:t=>{let e=n[t];return null==e?-1:e}}),r=bh(t,((e,r,o)=>{let s=Dl(i,e.from);if(null==s)return;/\S/.test(e.text)||(s=0);let a=/^\s*/.exec(e.text)[0],l=Yl(t,s);(a!=l||o.from{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(yh(e).map((({from:t,to:n})=>(t>0?t--:n{let n;if(t.lineWrapping){let i=t.lineBlockAt(e.head),r=t.coordsAtPos(e.head,e.assoc||1);r&&(n=i.bottom+t.documentTop-r.bottom+t.defaultLineHeight/2)}return t.moveVertically(e,!0,n)})).map(n);return t.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>BO(t,e,!1)},{key:"Mod-/",run:t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),i=iO(t.state,n.from);return i.line?tO(t):!!i.block&&nO(t)}},{key:"Alt-A",run:eO},{key:"Ctrl-m",mac:"Shift-Alt-m",run:t=>(t.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:VO,shift:KO,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>AO(t,!EO(t)),shift:t=>th(t,!EO(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>zO(t,(e=>GO(t,e,!EO(t)))),shift:t=>FO(t,(e=>GO(t,e,!EO(t)))),preventDefault:!0},{key:"ArrowRight",run:ZO,shift:JO,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>AO(t,EO(t)),shift:t=>th(t,EO(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>zO(t,(e=>GO(t,e,EO(t)))),shift:t=>FO(t,(e=>GO(t,e,EO(t)))),preventDefault:!0},{key:"ArrowUp",run:UO,shift:nh,preventDefault:!0},{mac:"Cmd-ArrowUp",run:ah,shift:ch},{mac:"Ctrl-ArrowUp",run:IO,shift:oh},{key:"ArrowDown",run:MO,shift:ih,preventDefault:!0},{mac:"Cmd-ArrowDown",run:lh,shift:Oh},{mac:"Ctrl-ArrowDown",run:NO,shift:sh},{key:"PageUp",run:IO,shift:oh},{key:"PageDown",run:NO,shift:sh},{key:"Home",run:t=>zO(t,(e=>GO(t,e,!1))),shift:t=>FO(t,(e=>GO(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:ah,shift:ch},{key:"End",run:t=>zO(t,(e=>GO(t,e,!0))),shift:t=>FO(t,(e=>GO(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:lh,shift:Oh},{key:"Enter",run:Qh,shift:Qh},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:fh,shift:fh},{key:"Delete",run:ph},{key:"Mod-Backspace",mac:"Alt-Backspace",run:gh},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>mh(t,!0)},{mac:"Mod-Backspace",run:t=>hh(t,(e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}))},{mac:"Mod-Delete",run:t=>hh(t,(e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head({mac:t.key,run:t.run,shift:t.shift})))));function kh(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];"string"==typeof r?t.setAttribute(i,r):null!=r&&(t[i]=r)}e++}for(;et.normalize("NFKD"):t=>t;class Xh{constructor(t,e,n=0,i=t.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,i),this.bufferStart=n,this.normalize=r?t=>r(Rh(t)):Rh,this.query=this.normalize(e)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return x(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=P(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=_(t);let i=this.normalize(e);if(i.length)for(let t=0,r=n;;t++){let o=i.charCodeAt(t),s=this.match(o,r,this.bufferPos+this.bufferStart);if(t==i.length-1){if(s)return this.value=s,this;break}r==n&&tthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let n=this.curLineStart+e.index,i=n+e[0].length;if(this.matchPos=Ah(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,i,e)))return this.value={from:n,to:i,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=n||i.to<=e){let i=new Vh(e,t.sliceString(e,n));return Eh.set(t,i),i}if(i.from==e&&i.to==n)return i;let{text:r,from:o}=i;return o>e&&(r=t.sliceString(e,o)+r,o=e),i.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let t=this.flat.from+e.index,n=t+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,n,e)))return this.value={from:t,to:n,match:e},this.matchPos=Ah(this.text,n+(t==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Vh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Ah(t,e){if(e>=t.length)return e;let n,i=t.lineAt(e);for(;e=56320&&n<57344;)e++;return e}function Wh(t){let e=kh("input",{class:"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function n(){let n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!n)return;let{state:i}=t,r=i.doc.lineAt(i.selection.main.head),[,o,s,a,l]=n,c=a?+a.slice(1):0,O=s?+s:r.number;if(s&&l){let t=O/100;o&&(t=t*("-"==o?-1:1)+r.number/i.doc.lines),O=Math.round(i.doc.lines*t)}else s&&o&&(O=O*("-"==o?-1:1)+r.number);let h=i.doc.line(Math.max(1,Math.min(i.doc.lines,O))),u=W.cursor(h.from+Math.max(0,Math.min(c,h.length)));t.dispatch({effects:[Yh.of(!1),ao.scrollIntoView(u.from,{y:"center"})],selection:u}),t.focus()}return{dom:kh("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Yh.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),n())},onsubmit:t=>{t.preventDefault(),n()}},kh("label",t.state.phrase("Go to line"),": ",e)," ",kh("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),kh("button",{name:"close",onclick:()=>{t.dispatch({effects:Yh.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]))}}"undefined"!=typeof Symbol&&(qh.prototype[Symbol.iterator]=Zh.prototype[Symbol.iterator]=function(){return this});const Yh=yt.define(),Dh=B.define({create:()=>!0,update(t,e){for(let n of e.effects)n.is(Yh)&&(t=n.value);return t},provide:t=>Ts.from(t,(t=>t?Wh:null))}),Uh=ao.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Mh={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},jh=U.define({combine:t=>Xt(t,Mh,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function Lh(t){let e=[Fh,Bh];return t&&e.push(jh.of(t)),e}const Ih=hn.mark({class:"cm-selectionMatch"}),Nh=hn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Gh(t,e,n,i){return!(0!=n&&t(e.sliceDoc(n-1,n))==Pt.Word||i!=e.doc.length&&t(e.sliceDoc(i,i+1))==Pt.Word)}const Bh=li.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(jh),{state:n}=t,i=n.selection;if(i.ranges.length>1)return hn.none;let r,o=i.main,s=null;if(o.empty){if(!e.highlightWordAroundCursor)return hn.none;let t=n.wordAt(o.head);if(!t)return hn.none;s=n.charCategorizer(o.head),r=n.sliceDoc(t.from,t.to)}else{let t=o.to-o.from;if(t200)return hn.none;if(e.wholeWords){if(r=n.sliceDoc(o.from,o.to),s=n.charCategorizer(o.head),!Gh(s,n,o.from,o.to)||!function(t,e,n,i){return t(e.sliceDoc(n,n+1))==Pt.Word&&t(e.sliceDoc(i-1,i))==Pt.Word}(s,n,o.from,o.to))return hn.none}else if(r=n.sliceDoc(o.from,o.to),!r)return hn.none}let a=[];for(let i of t.visibleRanges){let t=new Xh(n.doc,r,i.from,i.to);for(;!t.next().done;){let{from:i,to:r}=t.value;if((!s||Gh(s,n,i,r))&&(o.empty&&i<=o.from&&r>=o.to?a.push(Nh.range(i,r)):(i>=o.to||r<=o.from)&&a.push(Ih.range(i,r)),a.length>e.maxMatches))return hn.none}}return hn.set(a)}},{decorations:t=>t.decorations}),Fh=ao.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const Hh=U.define({combine:t=>Xt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Pu(t),scrollToMatch:t=>ao.scrollIntoView(t)})});class Kh{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,Ch),!0}catch(t){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,((t,e)=>"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"))}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new ou(this):new eu(this)}getCursor(t,e=0,n){let i=t.doc?t:Rt.create({doc:t});return null==n&&(n=i.doc.length),this.regexp?nu(this,i,e,n):tu(this,i,e,n)}}class Jh{constructor(t){this.spec=t}}function tu(t,e,n,i){return new Xh(e.doc,t.unquoted,n,i,t.caseSensitive?void 0:t=>t.toLowerCase(),t.wholeWord?function(t,e){return(n,i,r,o)=>((o>n||o+r.length=e)return null;i.push(n.value)}return i}highlight(t,e,n,i){let r=tu(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}function nu(t,e,n,i){return new qh(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),(t,e,n)=>!n[0].length||(r(iu(n.input,n.index))!=Pt.Word||r(ru(n.input,n.index))!=Pt.Word)&&(r(ru(n.input,n.index+n[0].length))!=Pt.Word||r(iu(n.input,n.index+n[0].length))!=Pt.Word)):void 0},n,i);var r}function iu(t,e){return t.slice(w(t,e,!1),e)}function ru(t,e){return t.slice(e,w(t,e))}class ou extends Jh{nextMatch(t,e,n){let i=nu(this.spec,t,n,t.doc.length).next();return i.done&&(i=nu(this.spec,t,0,e).next()),i.done?null:i.value}prevMatchInRange(t,e,n){for(let i=1;;i++){let r=Math.max(e,n-1e4*i),o=nu(this.spec,t,r,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(r==e||s.from>r+10))return s;if(r==e)return null}}prevMatch(t,e,n){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,n,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,((e,n)=>{if("&"==n)return t.match[0];if("$"==n)return"$";for(let e=n.length;e>0;e--){let i=+n.slice(0,e);if(i>0&&i=e)return null;i.push(n.value)}return i}highlight(t,e,n,i){let r=nu(this.spec,t,Math.max(0,e-250),Math.min(n+250,t.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}const su=yt.define(),au=yt.define(),lu=B.define({create:t=>new cu($u(t).create(),null),update(t,e){for(let n of e.effects)n.is(su)?t=new cu(n.value.create(),t.panel):n.is(au)&&(t=new cu(t.query,n.value?vu:null));return t},provide:t=>Ts.from(t,(t=>t.panel))});class cu{constructor(t,e){this.query=t,this.panel=e}}const Ou=hn.mark({class:"cm-searchMatch"}),hu=hn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),uu=li.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(lu))}update(t){let e=t.state.field(lu);(e!=t.startState.field(lu)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return hn.none;let{view:n}=this,i=new Zt;for(let e=0,r=n.visibleRanges,o=r.length;er[e+1].from-500;)a=r[++e].to;t.highlight(n.state,s,a,((t,e)=>{let r=n.state.selection.ranges.some((n=>n.from==t&&n.to==e));i.add(t,e,r?hu:Ou)}))}return i.finish()}},{decorations:t=>t.decorations});function du(t){return e=>{let n=e.state.field(lu,!1);return n&&n.query.spec.valid?t(e,n):bu(e)}}const fu=du(((t,{query:e})=>{let{to:n}=t.state.selection.main,i=e.nextMatch(t.state,n,n);if(!i)return!1;let r=W.single(i.from,i.to),o=t.state.facet(Hh);return t.dispatch({selection:r,effects:[Ru(t,i),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Su(t),!0})),pu=du(((t,{query:e})=>{let{state:n}=t,{from:i}=n.selection.main,r=e.prevMatch(n,i,i);if(!r)return!1;let o=W.single(r.from,r.to),s=t.state.facet(Hh);return t.dispatch({selection:o,effects:[Ru(t,r),s.scrollToMatch(o.main,t)],userEvent:"select.search"}),Su(t),!0})),mu=du(((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!(!n||!n.length)&&(t.dispatch({selection:W.create(n.map((t=>W.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),gu=du(((t,{query:e})=>{let{state:n}=t,{from:i,to:r}=n.selection.main;if(n.readOnly)return!1;let o=e.nextMatch(n,i,i);if(!o)return!1;let s,a,l=o,c=[],O=[];if(l.from==i&&l.to==r&&(a=n.toText(e.getReplacement(l)),c.push({from:l.from,to:l.to,insert:a}),l=e.nextMatch(n,l.from,l.to),O.push(ao.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(i).number)+"."))),l){let e=0==c.length||c[0].from>=o.to?0:o.to-o.from-a.length;s=W.single(l.from-e,l.to-e),O.push(Ru(t,l)),O.push(n.facet(Hh).scrollToMatch(s.main,t))}return t.dispatch({changes:c,selection:s,effects:O,userEvent:"input.replace"}),!0})),yu=du(((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map((t=>{let{from:n,to:i}=t;return{from:n,to:i,insert:e.getReplacement(t)}}));if(!n.length)return!1;let i=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:ao.announce.of(i),userEvent:"input.replace.all"}),!0}));function vu(t){return t.state.facet(Hh).createPanel(t)}function $u(t,e){var n,i,r,o,s;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(Hh);return new Kh({search:(null!==(n=null==e?void 0:e.literal)&&void 0!==n?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==e?void 0:e.caseSensitive)&&void 0!==i?i:c.caseSensitive,literal:null!==(r=null==e?void 0:e.literal)&&void 0!==r?r:c.literal,regexp:null!==(o=null==e?void 0:e.regexp)&&void 0!==o?o:c.regexp,wholeWord:null!==(s=null==e?void 0:e.wholeWord)&&void 0!==s?s:c.wholeWord})}function Qu(t){let e=xs(t,vu);return e&&e.dom.querySelector("[main-field]")}function Su(t){let e=Qu(t);e&&e==t.root.activeElement&&e.select()}const bu=t=>{let e=t.state.field(lu,!1);if(e&&e.panel){let n=Qu(t);if(n&&n!=t.root.activeElement){let i=$u(t.state,e.query.spec);i.valid&&t.dispatch({effects:su.of(i)}),n.focus(),n.select()}}else t.dispatch({effects:[au.of(!0),e?su.of($u(t.state,e.query.spec)):yt.appendConfig.of(zu)]});return!0},wu=t=>{let e=t.state.field(lu,!1);if(!e||!e.panel)return!1;let n=xs(t,vu);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:au.of(!1)}),!0},xu=[{key:"Mod-f",run:bu,scope:"editor search-panel"},{key:"F3",run:fu,shift:pu,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:fu,shift:pu,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:wu,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:i,to:r}=n.main,o=[],s=0;for(let e=new Xh(t.doc,t.sliceDoc(i,r));!e.next().done;){if(o.length>1e3)return!1;e.value.from==i&&(s=o.length),o.push(W.range(e.value.from,e.value.to))}return e(t.update({selection:W.create(o,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:t=>{let e=xs(t,Wh);if(!e){let n=[Yh.of(!0)];null==t.state.field(Dh,!1)&&n.push(yt.appendConfig.of([Dh,Uh])),t.dispatch({effects:n}),e=xs(t,Wh)}return e&&e.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some((t=>t.from===t.to)))return(({state:t,dispatch:e})=>{let{selection:n}=t,i=W.create(n.ranges.map((e=>t.wordAt(e.head)||W.cursor(e.head))),n.mainIndex);return!i.eq(n)&&(e(t.update({selection:i})),!0)})({state:t,dispatch:e});let i=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some((e=>t.sliceDoc(e.from,e.to)!=i)))return!1;let r=function(t,e){let{main:n,ranges:i}=t.selection,r=t.wordAt(n.head),o=r&&r.from==n.from&&r.to==n.to;for(let n=!1,r=new Xh(t.doc,e,i[i.length-1].to);;){if(r.next(),!r.done){if(n&&i.some((t=>t.from==r.value.from)))continue;if(o){let e=t.wordAt(r.value.from);if(!e||e.from!=r.value.from||e.to!=r.value.to)continue}return r.value}if(n)return null;r=new Xh(t.doc,e,0,Math.max(0,i[i.length-1].from-1)),n=!0}}(t,i);return!!r&&(e(t.update({selection:t.selection.addRange(W.range(r.from,r.to),!1),effects:ao.scrollIntoView(r.to)})),!0)},preventDefault:!0}];class Pu{constructor(t){this.view=t;let e=this.query=t.state.field(lu).query.spec;function n(t,e,n){return kh("button",{class:"cm-button",name:t,onclick:e,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=kh("input",{value:e.search,placeholder:_u(t,"Find"),"aria-label":_u(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=kh("input",{value:e.replace,placeholder:_u(t,"Replace"),"aria-label":_u(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=kh("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=kh("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=kh("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=kh("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,n("next",(()=>fu(t)),[_u(t,"next")]),n("prev",(()=>pu(t)),[_u(t,"previous")]),n("select",(()=>mu(t)),[_u(t,"all")]),kh("label",null,[this.caseField,_u(t,"match case")]),kh("label",null,[this.reField,_u(t,"regexp")]),kh("label",null,[this.wordField,_u(t,"by word")]),...t.state.readOnly?[]:[kh("br"),this.replaceField,n("replace",(()=>gu(t)),[_u(t,"replace")]),n("replaceAll",(()=>yu(t)),[_u(t,"replace all")])],kh("button",{name:"close",onclick:()=>wu(t),"aria-label":_u(t,"close"),type:"button"},["×"])])}commit(){let t=new Kh({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:su.of(t)}))}keydown(t){var e,n,i;e=this.view,n=t,i="search-panel",So(yo(e.state),n,e,i)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?pu:fu)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),gu(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(su)&&!t.value.eq(this.query)&&this.setQuery(t.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Hh).top}}function _u(t,e){return t.state.phrase(e)}const ku=30,Tu=/[\s\.,:;?!]/;function Ru(t,{from:e,to:n}){let i=t.state.doc.lineAt(e),r=t.state.doc.lineAt(n).to,o=Math.max(i.from,e-ku),s=Math.min(r,n+ku),a=t.state.sliceDoc(o,s);if(o!=i.from)for(let t=0;ta.length-ku;t--)if(!Tu.test(a[t-1])&&Tu.test(a[t])){a=a.slice(0,t);break}return ao.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${i.number}.`)}const Xu=ao.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),zu=[lu,et.low(uu),Xu];class Cu{constructor(t,e,n,i){this.state=t,this.pos=e,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let e=Pl(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),n=Math.max(e.from,this.pos-250),i=e.text.slice(n-e.from,this.pos-e.from),r=i.search(Au(t,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(t,e,n){"abort"==t&&this.abortListeners&&(this.abortListeners.push(e),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function qu(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Eu(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[n,i]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let t=1;t{let r=t.matchBefore(i);return r||t.explicit?{from:r?r.from:t.pos,options:e,validFor:n}:null}}class Vu{constructor(t,e,n,i){this.completion=t,this.source=e,this.match=n,this.score=i}}function Zu(t){return t.selection.main.from}function Au(t,e){var n;let{source:i}=t,r=e&&"^"!=i[0],o="$"!=i[i.length-1];return r||o?new RegExp(`${r?"^":""}(?:${i})${o?"$":""}`,null!==(n=t.flags)&&void 0!==n?n:t.ignoreCase?"i":""):t}const Wu=pt.define();const Yu=new WeakMap;function Du(t){if(!Array.isArray(t))return t;let e=Yu.get(t);return e||Yu.set(t,e=Eu(t)),e}const Uu=yt.define(),Mu=yt.define();class ju{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(y=P(l))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!i||1==v&&p||0==g&&0!=v)&&(e[O]==l||n[O]==l&&(h=!0)?o[O++]=i:o.length&&(m=!1)),g=v,i+=_(l)}return O==a&&0==o[0]&&m?this.result((h?-200:0)-100,o,t):u==a&&0==d?this.ret(-200-t.length+(f==t.length?0:-100),[0,f]):s>-1?this.ret(-700-t.length,[s,s+this.pattern.length]):u==a?this.ret(-900-t.length,[d,f]):O==a?this.result((h?-200:0)-100-700+(m?0:-1100),o,t):2==e.length?null:this.result((i[0]?-700:0)-200-1100,i,t)}result(t,e,n){let i=[],r=0;for(let t of e){let e=t+(this.astral?_(x(n,t)):1);r&&i[r-1]==t?i[r-1]=e:(i[r++]=t,i[r++]=e)}return this.ret(t-n.length,i)}}class Lu{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.lengthXt(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Gu,filterStrict:!1,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>n=>Nu(t(n),e(n)),optionClass:(t,e)=>n=>Nu(t(n),e(n)),addToOptions:(t,e)=>t.concat(e),filterStrict:(t,e)=>t||e})});function Nu(t,e){return t?e?t+" "+e:t:e}function Gu(t,e,n,i,r,o){let s,a,l=t.textDirection==bn.RTL,c=l,O=!1,h="top",u=e.left-r.left,d=r.right-e.right,f=i.right-i.left,p=i.bottom-i.top;if(c&&u=p||t>e.top?s=n.bottom-e.top:(h="bottom",s=e.bottom-n.top)}return{style:`${h}: ${s/((e.bottom-e.top)/o.offsetHeight)}px; max-width: ${a/((e.right-e.left)/o.offsetWidth)}px`,class:"cm-completionInfo-"+(O?l?"left-narrow":"right-narrow":c?"left":"right")}}function Bu(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/n);return{from:t*n,to:(t+1)*n}}let i=Math.floor((t-e)/n);return{from:t-(i+1)*n,to:t-i*n}}class Fu{constructor(t,e,n){this.view=t,this.stateField=e,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let i=t.state.field(e),{options:r,selected:o}=i.open,s=t.state.facet(Iu);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,n,i){let r=document.createElement("span");r.className="cm-completionLabel";let o=t.displayLabel||t.label,s=0;for(let t=0;ts&&r.appendChild(document.createTextNode(o.slice(s,e)));let a=r.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(o.slice(e,n))),a.className="cm-completionMatchedText",s=n}return st.position-e.position)).map((t=>t.render))}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=Bu(r.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(n=>{let{options:i}=t.state.field(e).open;for(let e,r=n.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(e=/-(\d+)$/.exec(r.id))&&+e[1]{let n=t.state.field(this.stateField,!1);n&&n.tooltip&&t.state.facet(Iu).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:Mu.of(null)})})),this.showOptions(r,i.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(t){var e;let n=t.state.field(this.stateField),i=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),n!=i){let{options:r,selected:o,disabled:s}=n.open;i.open&&i.open.options==r||(this.range=Bu(r.length,o,t.state.facet(Iu).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),s!=(null===(e=i.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=Bu(e.options.length,e.selected,this.view.state.facet(Iu).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();let{completion:n}=e.options[e.selected],{info:i}=n;if(!i)return;let r="string"==typeof i?document.createTextNode(i):i(n);if(!r)return;"then"in r?r.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e,n)})).catch((t=>ri(this.view.state,t,"completion info"))):this.addInfoPane(r,n)}}addInfoPane(t,e){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=t.nodeType)n.appendChild(t),this.infoDestroy=null;else{let{dom:e,destroy:i}=t;n.appendChild(e),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==t?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),e=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected"):i--;return e&&function(t,e){let n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),r=n.height/t.offsetHeight;i.topn.bottom&&(t.scrollTop+=(i.bottom-n.bottom)/r)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),r=this.space;if(!r){let t=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:t.clientWidth,bottom:t.clientHeight}}return i.top>Math.min(r.bottom,e.bottom)-10||i.bottom{t.target==i&&t.preventDefault()}));let r=null;for(let o=n.from;on.from||0==n.from))if(r=t,"string"!=typeof l&&l.header)i.appendChild(l.header(l));else{i.appendChild(document.createElement("completion-section")).textContent=t}}const c=i.appendChild(document.createElement("li"));c.id=e+"-"+o,c.setAttribute("role","option");let O=this.optionClass(s);O&&(c.className=O);for(let t of this.optionContent){let e=t(s,this.view.state,this.view,a);e&&c.appendChild(e)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.tonew Fu(n,t,e)}function Ku(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}class Ju{constructor(t,e,n,i,r,o){this.options=t,this.attrs=e,this.tooltip=n,this.timestamp=i,this.selected=r,this.disabled=o}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new Ju(this.options,id(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,n,i,r,o){if(i&&!o&&t.some((t=>t.isPending)))return i.setDisabled();let s=function(t,e){let n=[],i=null,r=t=>{n.push(t);let{section:e}=t.completion;if(e){i||(i=[]);let t="string"==typeof e?e:e.name;i.some((e=>e.name==t))||i.push("string"==typeof e?{name:t}:e)}},o=e.facet(Iu);for(let i of t)if(i.hasResult()){let t=i.result.getMatch;if(!1===i.result.filter)for(let e of i.result.options)r(new Vu(e,i.source,t?t(e):[],1e9-n.length));else{let n,s=e.sliceDoc(i.from,i.to),a=o.filterStrict?new Lu(s):new ju(s);for(let e of i.result.options)if(n=a.match(e.label)){let o=e.displayLabel?t?t(e,n.matched):[]:n.matched;r(new Vu(e,i.source,o,n.score+(e.boost||0)))}}}if(i){let t=Object.create(null),e=0,r=(t,e)=>{var n,i;return(null!==(n=t.rank)&&void 0!==n?n:1e9)-(null!==(i=e.rank)&&void 0!==i?i:1e9)||(t.namee.score-t.score||l(t.completion,e.completion)))){let e=t.completion;!a||a.label!=e.label||a.detail!=e.detail||null!=a.type&&null!=e.type&&a.type!=e.type||a.apply!=e.apply||a.boost!=e.boost?s.push(t):Ku(t.completion)>Ku(a)&&(s[s.length-1]=t),a=t.completion}return s}(t,e);if(!s.length)return i&&t.some((t=>t.isPending))?i.setDisabled():null;let a=e.facet(Iu).selectOnOpen?0:-1;if(i&&i.selected!=a&&-1!=i.selected){let t=i.options[i.selected].completion;for(let e=0;ee.hasResult()?Math.min(t,e.from):t),1e8),create:ud,above:r.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(t){return new Ju(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new Ju(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class td{constructor(t,e,n){this.active=t,this.id=e,this.open=n}static start(){return new td(rd,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,n=e.facet(Iu),i=(n.override||e.languageDataAt("autocomplete",Zu(e)).map(Du)).map((e=>(this.active.find((t=>t.source==e))||new sd(e,this.active.some((t=>0!=t.state))?1:0)).update(t,n)));i.length==this.active.length&&i.every(((t,e)=>t==this.active[e]))&&(i=this.active);let r=this.open,o=t.effects.some((t=>t.is(ld)));r&&t.docChanged&&(r=r.map(t.changes)),t.selection||i.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let n=0,i=0;;){for(;nt.isPending))&&(r=null),!r&&i.every((t=>!t.isPending))&&i.some((t=>t.hasResult()))&&(i=i.map((t=>t.hasResult()?new sd(t.source,0):t)));for(let e of t.effects)e.is(cd)&&(r=r&&r.setSelected(e.value,this.id));return i==this.active&&r==this.open?this:new td(i,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?ed:nd}}const ed={"aria-autocomplete":"list"},nd={};function id(t,e){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}const rd=[];function od(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(Wu);if(n&&e.activateOnCompletion(n))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class sd{constructor(t,e,n=!1){this.source=t,this.state=e,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(t,e){let n=od(t,e),i=this;(8&n||16&n&&this.touches(t))&&(i=new sd(i.source,0)),4&n&&0==i.state&&(i=new sd(this.source,1)),i=i.updateFor(t,n);for(let e of t.effects)if(e.is(Uu))i=new sd(i.source,1,e.value);else if(e.is(Mu))i=new sd(i.source,0);else if(e.is(ld))for(let t of e.value)t.source==i.source&&(i=t);return i}updateFor(t,e){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(Zu(t.state))}}class ad extends sd{constructor(t,e,n,i,r,o){super(t,3,e),this.limit=n,this.result=i,this.from=r,this.to=o}hasResult(){return!0}updateFor(t,e){var n;if(!(3&e))return this.map(t.changes);let i=this.result;i.map&&!t.changes.empty&&(i=i.map(i,t.changes));let r=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),s=Zu(t.state);if(s>o||!i||2&e&&(Zu(t.startState)==this.from||st.map((t=>t.map(e)))}),cd=yt.define(),Od=B.define({create:()=>td.start(),update:(t,e)=>t.update(e),provide:t=>[ps.from(t,(t=>t.tooltip)),ao.contentAttributes.from(t,(t=>t.attrs))]});function hd(t,e){const n=e.completion.apply||e.completion.label;let i=t.state.field(Od).active.find((t=>t.source==e.source));return i instanceof ad&&("string"==typeof n?t.dispatch(Object.assign(Object.assign({},function(t,e,n,i){let{main:r}=t.selection,o=n-r.from,s=i-r.from;return Object.assign(Object.assign({},t.changeByRange((a=>{if(a!=r&&n!=i&&t.sliceDoc(a.from+o,a.from+s)!=t.sliceDoc(n,i))return{range:a};let l=t.toText(e);return{changes:{from:a.from+o,to:i==r.from?a.to:a.from+s,insert:l},range:W.cursor(a.from+o+l.length)}}))),{scrollIntoView:!0,userEvent:"input.complete"})}(t.state,n,i.from,i.to)),{annotations:Wu.of(e.completion)})):n(t,e.completion,i.from,i.to),!0)}const ud=Hu(Od,hd);function dd(t,e="option"){return n=>{let i=n.state.field(Od,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+o*(t?1:-1):t?0:s-1;return a<0?a="page"==e?0:s-1:a>=s&&(a="page"==e?s-1:0),n.dispatch({effects:cd.of(a)}),!0}}const fd=t=>!!t.state.field(Od,!1)&&(t.dispatch({effects:Uu.of(!0)}),!0);class pd{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const md=li.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Od).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Od),n=t.state.facet(Iu);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Od)==e)return;let i=t.transactions.some((t=>{let e=od(t,n);return 8&e||(t.selection||t.docChanged)&&!(3&e)}));for(let e=0;e50&&Date.now()-n.time>1e3){for(let t of n.context.abortListeners)try{t()}catch(t){ri(this.view.state,t)}n.context.abortListeners=null,this.running.splice(e--,1)}else n.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some((t=>t.effects.some((t=>t.is(Uu)))))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some((t=>t.isPending&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),r):-1,0!=this.composing)for(let e of t.transactions)e.isUserEvent("input.type")?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Od);for(let t of e.active)t.isPending&&!this.running.some((e=>e.active.source==t.source))&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(Iu).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Zu(e),i=new Cu(e,n,t.explicit,this.view),r=new pd(t,i);this.running.push(r),Promise.resolve(t.source(i)).then((t=>{r.context.aborted||(r.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:Mu.of(null)}),ri(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(Iu).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Iu),i=this.view.state.field(Od);for(let r=0;rt.source==o.active.source));if(s&&s.isPending)if(null==o.done){let t=new sd(o.active.source,0);for(let e of o.updates)t=t.update(e,n);t.isPending||e.push(t)}else this.startQuery(s)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:ld.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Od,!1);if(e&&e.tooltip&&this.view.state.facet(Iu).closeOnBlur){let n=e.open&&Ss(this.view,e.open.tooltip);n&&n.dom.contains(t.relatedTarget)||setTimeout((()=>this.view.dispatch({effects:Mu.of(null)})),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Uu.of(!1)})),20),this.composing=0}}}),gd="object"==typeof navigator&&/Win/.test(navigator.platform),yd=et.highest(ao.domEventHandlers({keydown(t,e){let n=e.state.field(Od,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&(!gd||!t.altKey)||t.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find((t=>t.source==i.source)),o=i.completion.commitCharacters||r.result.commitCharacters;return o&&o.indexOf(t.key)>-1&&hd(e,i),!1}})),vd=ao.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class $d{constructor(t,e,n,i){this.field=t,this.line=e,this.from=n,this.to=i}}class Qd{constructor(t,e,n){this.field=t,this.from=e,this.to=n}map(t){let e=t.mapPos(this.from,-1,T.TrackDel),n=t.mapPos(this.to,1,T.TrackDel);return null==e||null==n?null:new Qd(this.field,e,n)}}class Sd{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let n=[],i=[e],r=t.doc.lineAt(e),o=/^\s*/.exec(r.text)[0];for(let r of this.lines){if(n.length){let n=o,s=/^\t*/.exec(r)[0].length;for(let e=0;enew Qd(t.field,i[t.line]+t.from,i[t.line]+t.to)));return{text:n,ranges:s}}static parse(t){let e,n=[],i=[],r=[];for(let o of t.split(/\r\n?|\n/)){for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(o);){let t=e[1]?+e[1]:null,s=e[2]||e[3]||"",a=-1,l=s.replace(/\\[{}]/g,(t=>t[1]));for(let e=0;e=a&&t.field++}r.push(new $d(a,i.length,e.index,e.index+l.length)),o=o.slice(0,e.index)+s+o.slice(e.index+e[0].length)}o=o.replace(/\\([{}])/g,((t,e,n)=>{for(let t of r)t.line==i.length&&t.from>n&&(t.from--,t.to--);return e})),i.push(o)}return new Sd(i,r)}}let bd=hn.widget({widget:new class extends cn{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),wd=hn.mark({class:"cm-snippetField"});class xd{constructor(t,e){this.ranges=t,this.active=e,this.deco=hn.set(t.map((t=>(t.from==t.to?bd:wd).range(t.from,t.to))))}map(t){let e=[];for(let n of this.ranges){let i=n.map(t);if(!i)return null;e.push(i)}return new xd(e,this.active)}selectionInsideField(t){return t.ranges.every((t=>this.ranges.some((e=>e.field==this.active&&e.from<=t.from&&e.to>=t.to))))}}const Pd=yt.define({map:(t,e)=>t&&t.map(e)}),_d=yt.define(),kd=B.define({create:()=>null,update(t,e){for(let n of e.effects){if(n.is(Pd))return n.value;if(n.is(_d)&&t)return new xd(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>ao.decorations.from(t,(t=>t?t.deco:hn.none))});function Td(t,e){return W.create(t.filter((t=>t.field==e)).map((t=>W.range(t.from,t.to))))}function Rd(t){let e=Sd.parse(t);return(t,n,i,r)=>{let{text:o,ranges:s}=e.instantiate(t.state,i),{main:a}=t.state.selection,l={changes:{from:i,to:r==a.from?a.to:r,insert:f.of(o)},scrollIntoView:!0,annotations:n?[Wu.of(n),vt.userEvent.of("input.complete")]:void 0};if(s.length&&(l.selection=Td(s,0)),s.some((t=>t.field>0))){let e=new xd(s,0),n=l.effects=[Pd.of(e)];void 0===t.state.field(kd,!1)&&n.push(yt.appendConfig.of([kd,qd,Vd,vd]))}t.dispatch(t.state.update(l))}}function Xd(t){return({state:e,dispatch:n})=>{let i=e.field(kd,!1);if(!i||t<0&&0==i.active)return!1;let r=i.active+t,o=t>0&&!i.ranges.some((e=>e.field==r+t));return n(e.update({selection:Td(i.ranges,r),effects:Pd.of(o?null:new xd(i.ranges,r)),scrollIntoView:!0})),!0}}const zd=[{key:"Tab",run:Xd(1),shift:Xd(-1)},{key:"Escape",run:({state:t,dispatch:e})=>!!t.field(kd,!1)&&(e(t.update({effects:Pd.of(null)})),!0)}],Cd=U.define({combine:t=>t.length?t[0]:zd}),qd=et.highest(mo.compute([Cd],(t=>t.facet(Cd))));function Ed(t,e){return Object.assign(Object.assign({},e),{apply:Rd(t)})}const Vd=ao.domEventHandlers({mousedown(t,e){let n,i=e.state.field(kd,!1);if(!i||null==(n=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;let r=i.ranges.find((t=>t.from<=n&&t.to>=n));return!(!r||r.field==i.active)&&(e.dispatch({selection:Td(i.ranges,r.field),effects:Pd.of(i.ranges.some((t=>t.field>r.field))?new xd(i.ranges,r.field):null),scrollIntoView:!0}),!0)}});const Zd={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ad=yt.define({map(t,e){let n=e.mapPos(t,-1,T.TrackAfter);return null==n?void 0:n}}),Wd=new class extends zt{};Wd.startSide=1,Wd.endSide=-1;const Yd=B.define({create:()=>Vt.empty,update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:t=>t>=n.from&&t<=n.to})}for(let n of e.effects)n.is(Ad)&&(t=t.update({add:[Wd.range(n.value,n.value+1)]}));return t}});const Dd="()[]{}<>«»»«[]{}";function Ud(t){for(let e=0;e<16;e+=2)if(Dd.charCodeAt(e)==t)return Dd.charAt(e+1);return P(t<128?t:t+1)}function Md(t,e){return t.languageDataAt("closeBrackets",e)[0]||Zd}const jd="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Ld=ao.inputHandler.of(((t,e,n,i)=>{if((jd?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let r=t.state.selection.main;if(i.length>2||2==i.length&&1==_(x(i,0))||e!=r.from||n!=r.to)return!1;let o=function(t,e){let n=Md(t,t.selection.main.head),i=n.brackets||Zd.brackets;for(let r of i){let o=Ud(x(r,0));if(e==r)return o==r?Hd(t,r,i.indexOf(r+r+r)>-1,n):Bd(t,r,o,n.before||Zd.before);if(e==o&&Nd(t,t.selection.main.from))return Fd(t,r,o)}return null}(t.state,i);return!!o&&(t.dispatch(o),!0)})),Id=[{key:"Backspace",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Md(t,t.selection.main.head).brackets||Zd.brackets,i=null,r=t.changeByRange((e=>{if(e.empty){let i=function(t,e){let n=t.sliceString(e-2,e);return _(x(n,0))==n.length?n:n.slice(1)}(t.doc,e.head);for(let r of n)if(r==i&&Gd(t.doc,e.head)==Ud(x(r,0)))return{changes:{from:e.head-r.length,to:e.head+r.length},range:W.cursor(e.head-r.length)}}return{range:i=e}}));return i||e(t.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function Nd(t,e){let n=!1;return t.field(Yd).between(0,t.doc.length,(t=>{t==e&&(n=!0)})),n}function Gd(t,e){let n=t.sliceString(e,e+2);return n.slice(0,_(x(n,0)))}function Bd(t,e,n,i){let r=null,o=t.changeByRange((o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Ad.of(o.to+e.length),range:W.range(o.anchor+e.length,o.head+e.length)};let s=Gd(t.doc,o.head);return!s||/\s/.test(s)||i.indexOf(s)>-1?{changes:{insert:e+n,from:o.head},effects:Ad.of(o.head+e.length),range:W.cursor(o.head+e.length)}:{range:r=o}}));return r?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Fd(t,e,n){let i=null,r=t.changeByRange((e=>e.empty&&Gd(t.doc,e.head)==n?{changes:{from:e.head,to:e.head+n.length,insert:n},range:W.cursor(e.head+n.length)}:i={range:e}));return i?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Hd(t,e,n,i){let r=i.stringPrefixes||Zd.stringPrefixes,o=null,s=t.changeByRange((i=>{if(!i.empty)return{changes:[{insert:e,from:i.from},{insert:e,from:i.to}],effects:Ad.of(i.to+e.length),range:W.range(i.anchor+e.length,i.head+e.length)};let s,a=i.head,l=Gd(t.doc,a);if(l==e){if(Kd(t,a))return{changes:{insert:e+e,from:a},effects:Ad.of(a+e.length),range:W.cursor(a+e.length)};if(Nd(t,a)){let i=n&&t.sliceDoc(a,a+3*e.length)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+i.length,insert:i},range:W.cursor(a+i.length)}}}else{if(n&&t.sliceDoc(a-2*e.length,a)==e+e&&(s=Jd(t,a-2*e.length,r))>-1&&Kd(t,s))return{changes:{insert:e+e+e+e,from:a},effects:Ad.of(a+e.length),range:W.cursor(a+e.length)};if(t.charCategorizer(a)(l)!=Pt.Word&&Jd(t,a,r)>-1&&!function(t,e,n,i){let r=Pl(t).resolveInner(e,-1),o=i.reduce(((t,e)=>Math.max(t,e.length)),0);for(let s=0;s<5;s++){let s=t.sliceDoc(r.from,Math.min(r.to,r.from+n.length+o)),a=s.indexOf(n);if(!a||a>-1&&i.indexOf(s.slice(0,a))>-1){let e=r.firstChild;for(;e&&e.from==r.from&&e.to-e.from>n.length+a;){if(t.sliceDoc(e.to-n.length,e.to)==n)return!1;e=e.firstChild}return!0}let l=r.to==e&&r.parent;if(!l)break;r=l}return!1}(t,a,e,r))return{changes:{insert:e+e,from:a},effects:Ad.of(a+e.length),range:W.cursor(a+e.length)}}return{range:o=i}}));return o?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Kd(t,e){let n=Pl(t).resolveInner(e+1);return n.parent&&n.from==e}function Jd(t,e,n){let i=t.charCategorizer(e);if(i(t.sliceDoc(e-1,e))!=Pt.Word)return e;for(let r of n){let n=e-r.length;if(t.sliceDoc(n,e)==r&&i(t.sliceDoc(n-1,n))!=Pt.Word)return n}return-1}function tf(t={}){return[yd,Od,Iu.of(t),md,nf,vd]}const ef=[{key:"Ctrl-Space",run:fd},{mac:"Alt-`",run:fd},{key:"Escape",run:t=>{let e=t.state.field(Od,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:Mu.of(null)}),!0)}},{key:"ArrowDown",run:dd(!0)},{key:"ArrowUp",run:dd(!1)},{key:"PageDown",run:dd(!0,"page")},{key:"PageUp",run:dd(!1,"page")},{key:"Enter",run:t=>{let e=t.state.field(Od,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.facet(Iu).defaultKeymap?[ef]:[])));class rf{constructor(t,e,n){this.from=t,this.to=e,this.diagnostic=n}}class of{constructor(t,e,n){this.diagnostics=t,this.panel=e,this.selected=n}static init(t,e,n){let i=n.facet(yf).markerFilter;i&&(t=i(t,n));let r=t.slice().sort(((t,e)=>t.from-e.from||t.to-e.to)),o=new Zt,s=[],a=0;for(let t=0;;){let e,i,l=t==r.length?null:r[t];if(!l&&!s.length)break;for(s.length?(e=a,i=s.reduce(((t,e)=>Math.min(t,e.to)),l&&l.from>e?l.from:1e8)):(e=l.from,i=l.to,s.push(l),t++);tn.from||n.to==e)){i=Math.min(n.from,i);break}s.push(n),t++,i=Math.min(n.to,i)}let c=kf(s);if(s.some((t=>t.from==t.to||t.from==t.to-1&&n.doc.lineAt(t.from).to==t.from)))o.add(e,e,hn.widget({widget:new Qf(c),diagnostics:s.slice()}));else{let t=s.reduce(((t,e)=>e.markClass?t+" "+e.markClass:t),"");o.add(e,i,hn.mark({class:"cm-lintRange cm-lintRange-"+c+t,diagnostics:s.slice(),inclusiveEnd:s.some((t=>t.to>i))}))}a=i;for(let t=0;t{if(!(e&&r.diagnostics.indexOf(e)<0))if(i){if(r.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new rf(i.from,n,i.diagnostic)}else i=new rf(t,n,e||r.diagnostics[0])})),i}function af(t,e){let n=e.pos,i=e.end||n,r=t.state.facet(yf).hideOn(t,n,i);if(null!=r)return r;let o=t.startState.doc.lineAt(e.pos);return!(!t.effects.some((t=>t.is(cf)))&&!t.changes.touchesRange(o.from,Math.max(o.to,i)))}function lf(t,e){return t.field(uf,!1)?e:e.concat(yt.appendConfig.of(Tf))}const cf=yt.define(),Of=yt.define(),hf=yt.define(),uf=B.define({create:()=>new of(hn.none,null,null),update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),i=null,r=t.panel;if(t.selected){let r=e.changes.mapPos(t.selected.from,1);i=sf(n,t.selected.diagnostic,r)||sf(n,null,r)}!n.size&&r&&e.state.facet(yf).autoPanel&&(r=null),t=new of(n,r,i)}for(let n of e.effects)if(n.is(cf)){let i=e.state.facet(yf).autoPanel?n.value.length?bf.open:null:t.panel;t=of.init(n.value,i,e.state)}else n.is(Of)?t=new of(t.diagnostics,n.value?bf.open:null,t.selected):n.is(hf)&&(t=new of(t.diagnostics,t.panel,n.value));return t},provide:t=>[Ts.from(t,(t=>t.panel)),ao.decorations.from(t,(t=>t.diagnostics))]});const df=hn.mark({class:"cm-lintRange cm-lintRange-active"});function ff(t,e,n){let i,{diagnostics:r}=t.state.field(uf),o=-1,s=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),((t,r,{spec:a})=>{if(e>=t&&e<=r&&(t==r||(e>t||n>0)&&(e({dom:pf(t,i)})}:null}function pf(t,e){return kh("ul",{class:"cm-tooltip-lint"},e.map((e=>$f(t,e,!1))))}const mf=t=>{let e=t.state.field(uf,!1);return!(!e||!e.panel)&&(t.dispatch({effects:Of.of(!1)}),!0)},gf=[{key:"Mod-Shift-m",run:t=>{let e=t.state.field(uf,!1);e&&e.panel||t.dispatch({effects:lf(t.state,[Of.of(!0)])});let n=xs(t,bf.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:t=>{let e=t.state.field(uf,!1);if(!e)return!1;let n=t.state.selection.main,i=e.diagnostics.iter(n.to+1);return!(!i.value&&(i=e.diagnostics.iter(0),!i.value||i.from==n.from&&i.to==n.to))&&(t.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)}}];const yf=U.define({combine:t=>Object.assign({sources:t.map((t=>t.source)).filter((t=>null!=t))},Xt(t.map((t=>t.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(t,e)=>t?e?n=>t(n)||e(n):t:e}))});function vf(t){let e=[];if(t)t:for(let{name:n}of t){for(let t=0;tt.toLowerCase()==i.toLowerCase()))){e.push(i);continue t}}e.push("")}return e}function $f(t,e,n){var i;let r=n?vf(e.actions):[];return kh("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},kh("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),null===(i=e.actions)||void 0===i?void 0:i.map(((n,i)=>{let o=!1,s=i=>{if(i.preventDefault(),o)return;o=!0;let r=sf(t.state.field(uf).diagnostics,e);r&&n.apply(t,r.from,r.to)},{name:a}=n,l=r[i]?a.indexOf(r[i]):-1,c=l<0?a:[a.slice(0,l),kh("u",a.slice(l,l+1)),a.slice(l+1)];return kh("button",{type:"button",class:"cm-diagnosticAction",onclick:s,onmousedown:s,"aria-label":` Action: ${a}${l<0?"":` (access key "${r[i]})"`}.`},c)})),e.source&&kh("div",{class:"cm-diagnosticSource"},e.source))}class Qf extends cn{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return kh("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Sf{constructor(t,e){this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=$f(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class bf{constructor(t){this.view=t,this.items=[];this.list=kh("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:e=>{if(27==e.keyCode)mf(this.view),this.view.focus();else if(38==e.keyCode||33==e.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==e.keyCode||34==e.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==e.keyCode)this.moveSelection(0);else if(35==e.keyCode)this.moveSelection(this.items.length-1);else if(13==e.keyCode)this.view.focus();else{if(!(e.keyCode>=65&&e.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=vf(n.actions);for(let r=0;r{for(let e=0;emf(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(uf).selected;if(!t)return-1;for(let e=0;e{for(let t of a.diagnostics){if(o.has(t))continue;o.add(t);let s,a=-1;for(let e=n;en&&(this.items.splice(n,a-n),i=!0)),e&&s.diagnostic==e.diagnostic?s.dom.hasAttribute("aria-selected")||(s.dom.setAttribute("aria-selected","true"),r=s):s.dom.hasAttribute("aria-selected")&&s.dom.removeAttribute("aria-selected"),n++}}));n({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:t,panel:e})=>{let n=e.height/this.list.offsetHeight;t.tope.bottom&&(this.list.scrollTop+=(t.bottom-e.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let t=this.list.firstChild;function e(){let e=t;t=e.nextSibling,e.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;t!=n.dom;)e();t=n.dom.nextSibling}else this.list.insertBefore(n.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=sf(this.view.state.field(uf).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:hf.of(e)})}static open(t){return new bf(t)}}function wf(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function xf(t){return wf(``,'width="6" height="3"')}const Pf=ao.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:xf("#d11")},".cm-lintRange-warning":{backgroundImage:xf("orange")},".cm-lintRange-info":{backgroundImage:xf("#999")},".cm-lintRange-hint":{backgroundImage:xf("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function _f(t){return"error"==t?4:"warning"==t?3:"info"==t?2:1}function kf(t){let e="hint",n=1;for(let i of t){let t=_f(i.severity);t>n&&(n=t,e=i.severity)}return e}const Tf=[uf,ao.decorations.compute([uf],(t=>{let{selected:e,panel:n}=t.field(uf);return e&&n&&e.from!=e.to?hn.set([df.range(e.from,e.to)]):hn.none})),Qs(ff,{hideOn:af}),Pf];const Rf=(()=>[Fs(),Js,Io(),uO(),Sc(),Ro(),[Zo,Ao],Rt.allowMultipleSelections.of(!0),Rt.transactionFilter.of((t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:i}=t.newSelection.main,r=n.lineAt(i);if(i>r.from+200)return t;let o=n.sliceString(r.from,i);if(!e.some((t=>t.test(o))))return t;let{state:s}=t,a=-1,l=[];for(let{head:t}of s.selection.ranges){let e=s.doc.lineAt(t);if(e.from==a)continue;a=e.from;let n=Dl(s,e.from);if(null==n)continue;let i=/^\s*/.exec(e.text)[0],r=Yl(s,n);i!=r&&l.push({from:e.from,to:e.from+i.length,insert:r})}return l.length?[t,{changes:l,sequential:!0}]:t})),kc(Xc,{fallback:!0}),Yc(),[Ld,Yd],tf(),ns(),os(),Ho,Lh(),mo.of([...Id,..._h,...xu,...TO,...dc,...ef,...gf])])();var Xf=n(606);class zf{constructor(t,e,n,i,r,o,s,a,l,c=0,O){this.p=t,this.stack=e,this.state=n,this.reducePos=i,this.pos=r,this.score=o,this.buffer=s,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter(((t,e)=>e%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,n=0){let i=t.parser.context;return new zf(t,[],e,n,n,0,[],0,i?new Cf(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let n=t>>19,i=65535&t,{parser:r}=this.p,o=this.reducePos=2e3&&!(null===(e=this.p.parser.nodeSet.types[i])||void 0===e?void 0:e.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(i,l)}storeNode(t,e,n,i=4,r=!1){if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==t.buffer[i-4]&&t.buffer[i-1]>-1){if(e==n)return;if(t.buffer[i-2]>=e)return void(t.buffer[i-2]=n)}}if(r&&this.pos!=n){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4]){let t=!1;for(let e=r;e>0&&this.buffer[e-2]>n;e-=4)if(this.buffer[e-1]>=0){t=!0;break}if(t)for(;r>0&&this.buffer[r-2]>n;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=n,this.buffer[r+3]=i}else this.buffer.push(t,e,n,i)}shift(t,e,n,i){if(131072&t)this.pushState(65535&t,this.pos);else if(262144&t)this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4);else{let r=t,{parser:o}=this.p;(i>this.pos||e<=o.maxNode)&&(this.pos=i,o.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,n),this.shiftContext(e,n),e<=o.maxNode&&this.buffer.push(e,n,i,4)}}apply(t,e,n,i){65536&t?this.reduce(t):this.shift(t,e,n,i)}useNode(t,e){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=t)&&(this.p.reused.push(t),n++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let n=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new zf(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let n=t<=this.p.parser.maxNode;n&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,n?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new qf(this);;){let n=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==n)return!1;if(!(65536&n))return!0;e.reduce(n)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let n=[];for(let i,r=0;r1&e&&t==i))||n.push(e[t],i)}e=n}let n=[];for(let t=0;t>19,i=65535&e,r=this.stack.length-3*n;if(r<0||t.getGoto(this.stack[r],i,!1)<0){let t=this.findForcedReduction();if(null==t)return!1;e=t}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],n=(i,r)=>{if(!e.includes(i))return e.push(i),t.allActions(i,(e=>{if(393216&e);else if(65536&e){let n=(e>>19)-r;if(n>1){let i=65535&e,r=this.stack.length-3*n;if(r>=0&&t.getGoto(this.stack[r],i,!1)>=0)return n<<19|65536|i}}else{let t=n(e,r+1);if(null!=t)return t}}))};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:t}=this.p;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Cf{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class qf{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=65535&t,n=t>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class Ef{constructor(t,e,n){this.stack=t,this.pos=e,this.index=n,this.buffer=t.buffer,0==this.index&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new Ef(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Ef(this.stack,this.pos,this.index)}}function Vf(t,e=Uint16Array){if("string"!=typeof t)return t;let n=null;for(let i=0,r=0;i=92&&e--,e>=34&&e--;let r=e-32;if(r>=46&&(r-=46,n=!0),o+=r,n)break;o*=46}n?n[r++]=o:n=new e(o)}return n}class Zf{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Af=new Zf;class Wf{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Af,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let n=this.range,i=this.rangeIndex,r=this.pos+t;for(;rn.to:r>=n.to;){if(i==this.ranges.length-1)return null;let t=this.ranges[++i];r+=t.from-n.to,n=t}return r}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e,n,i=this.chunkOff+t;if(i>=0&&i=this.chunk2Pos&&ei.to&&(this.chunk2=this.chunk2.slice(0,i.to-e)),n=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),n}acceptToken(t,e=0){let n=e?this.resolveOffset(e,-1):this.pos;if(null==n||n=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Af,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let n="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(n+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return n}}class Yf{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:n}=e.p;Mf(this.data,t,e,this.id,n.data,n.tokenPrecTable)}}Yf.prototype.contextual=Yf.prototype.fallback=Yf.prototype.extend=!1;class Df{constructor(t,e,n){this.precTable=e,this.elseToken=n,this.data="string"==typeof t?Vf(t):t}token(t,e){let n=t.pos,i=0;for(;;){let n=t.next<0,r=t.resolveOffset(1,1);if(Mf(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(null==this.elseToken)return;if(n||i++,null==r)break;t.reset(r,t.token)}i&&(t.reset(n,t.token),t.acceptToken(this.elseToken,i))}}Df.prototype.contextual=Yf.prototype.fallback=Yf.prototype.extend=!1;class Uf{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function Mf(t,e,n,i,r,o){let s=0,a=1<0){let n=t[i];if(l.allows(n)&&(-1==e.token.value||e.token.value==n||Lf(n,e.token.value,r,o))){e.acceptToken(n);break}}let i=e.next,c=0,O=t[s+2];if(!(e.next<0&&O>c&&65535==t[n+3*O-3])){for(;c>1,o=n+r+(r<<1),a=t[o],l=t[o+1]||65536;if(i=l)){s=t[o+2],e.advance();continue t}c=r+1}}break}s=t[n+3*O-1]}}function jf(t,e,n){for(let i,r=e;65535!=(i=t[r]);r++)if(i==n)return r-e;return-1}function Lf(t,e,n,i){let r=jf(n,i,e);return r<0||jf(n,i,t)e)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:t.length}}class Bf{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Gf(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Gf(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(r instanceof ha){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+r.length}}}class Ff{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map((t=>new Zf))}getActions(t){let e=0,n=null,{parser:i}=t.p,{tokenizers:r}=i,o=i.stateSlot(t.state,3),s=t.curContext?t.curContext.hash:0,a=0;for(let i=0;ic.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let i=e;if(c.extended>-1&&(e=this.addActions(t,c.extended,c.end,e)),e=this.addActions(t,c.value,c.end,e),!l.extend&&(n=c,e>i))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),n||t.pos!=this.stream.end||(n=new Zf,n.value=t.p.parser.eofTerm,n.start=n.end=t.pos,e=this.addActions(t,n.value,n.end,e)),this.mainToken=n,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Zf,{pos:n,p:i}=t;return e.start=n,e.end=Math.min(n+1,i.stream.end),e.value=n==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,n){let i=this.stream.clipPos(n.pos);if(e.token(this.stream.reset(i,t),n),t.value>-1){let{parser:e}=n.p;for(let i=0;i=0&&n.p.parser.dialect.allows(r>>1)){1&r?t.extended=r>>1:t.value=r>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,n,i){for(let e=0;e4*t.bufferLength?new Bf(n,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t,e,n=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[t]=n;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;oi)r.push(s);else{if(this.advanceStack(s,r,n))continue;{t||(t=[],e=[]),t.push(s);let n=this.tokens.getMainToken(s);e.push(n.value,n.end)}}break}}if(!r.length){let e=t&&function(t){let e=null;for(let n of t){let t=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=t&&n.pos>t)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,r);if(n)return If&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let t=1==this.recovering?1:3*this.recovering;if(r.length>t)for(r.sort(((t,e)=>e.score-t.score));r.length>t;)r.pop();r.some((t=>t.reducePos>i))&&this.recovering--}else if(r.length>1){t:for(let t=0;t500&&i.buffer.length>500){if(!((e.score-i.score||e.buffer.length-i.buffer.length)>0)){r.splice(t--,1);continue t}r.splice(n--,1)}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let t=1;t ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let e=t.curContext&&t.curContext.tracker.strict,n=e?t.curContext.hash:0;for(let s=this.fragments.nodeAt(i);s;){let i=this.parser.nodeSet.types[s.type.id]==s.type?r.getGoto(t.state,s.type.id):-1;if(i>-1&&s.length&&(!e||(s.prop(ia.contextHash)||0)==n))return t.useNode(s,i),If&&console.log(o+this.stackID(t)+` (via reuse of ${r.getName(s.type.id)})`),!0;if(!(s instanceof ha)||0==s.children.length||s.positions[0]>0)break;let a=s.children[0];if(!(a instanceof ha&&0==s.positions[0]))break;s=a}}let s=r.stateSlot(t.state,4);if(s>0)return t.reduce(s),If&&console.log(o+this.stackID(t)+` (via always-reduce ${r.getName(65535&s)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let s=0;si?e.push(u):n.push(u)}return!1}advanceFully(t,e){let n=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return Kf(t,e),!0}}runRecovery(t,e,n){let i=null,r=!1;for(let o=0;o ":"";if(s.deadEnd){if(r)continue;if(r=!0,s.restart(),If&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))continue}let O=s.split(),h=c;for(let t=0;O.forceReduce()&&t<10;t++){if(If&&console.log(h+this.stackID(O)+" (via force-reduce)"),this.advanceFully(O,n))break;If&&(h=this.stackID(O)+" -> ")}for(let t of s.recoverByInsert(a))If&&console.log(c+this.stackID(t)+" (via recover-insert)"),this.advanceFully(t,n);this.stream.end>s.pos?(l==s.pos&&(l++,a=0),s.recoverByDelete(a,l),If&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(a)})`),Kf(s,n)):(!i||i.scoret;class ep{constructor(t){this.start=t.start,this.shift=t.shift||tp,this.reduce=t.reduce||tp,this.reuse=t.reuse||tp,this.hash=t.hash||(()=>0),this.strict=!1!==t.strict}}class np extends Xa{constructor(t){if(super(),this.wrappers=[],14!=t.version)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;nt.topRules[e][1])),i=[];for(let t=0;t=0)r(i,t,e[n++]);else{let o=e[n+-i];for(let s=-i;s>0;s--)r(e[n++],t,o);n++}}}this.nodeSet=new aa(e.map(((e,r)=>sa.define({name:r>=this.minRepeatTerm?void 0:e,id:r,props:i[r],top:n.indexOf(r)>-1,error:0==r,skipped:t.skippedNodes&&t.skippedNodes.indexOf(r)>-1})))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=ta;let o=Vf(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let t=0;t"number"==typeof t?new Yf(o,t):t)),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,n){let i=new Hf(this,t,e,n);for(let r of this.wrappers)i=r(i,t,e,n);return i}getGoto(t,e,n=!1){let i=this.goto;if(e>=i[0])return-1;for(let r=i[e+1];;){let e=i[r++],o=1&e,s=i[r++];if(o&&n)return s;for(let n=r+(e>>1);r0}validAction(t,e){return!!this.allActions(t,(t=>t==e||null))}allActions(t,e){let n=this.stateSlot(t,4),i=n?e(n):void 0;for(let n=this.stateSlot(t,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=ip(this.data,n+2)}i=e(ip(this.data,n+1))}return i}nextStates(t){let e=[];for(let n=this.stateSlot(t,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=ip(this.data,n+2)}if(!(1&this.data[n+2])){let t=this.data[n+1];e.some(((e,n)=>1&n&&e==t))||e.push(this.data[n],t)}}return e}configure(t){let e=Object.assign(Object.create(np.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let n=this.topRules[t.top];if(!n)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=n}return t.tokenizers&&(e.tokenizers=this.tokenizers.map((e=>{let n=t.tokenizers.find((t=>t.from==e));return n?n.to:e}))),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map(((n,i)=>{let r=t.specializers.find((t=>t.from==n.external));if(!r)return n;let o=Object.assign(Object.assign({},n),{external:r.to});return e.specializers[i]=rp(o),o}))),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),null!=t.bufferLength&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return null==e?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),n=e.map((()=>!1));if(t)for(let i of t.split(" ")){let t=e.indexOf(i);t>=0&&(n[t]=!0)}let i=null;for(let t=0;tt.external(n,i)<<1|e}return t.get}const op=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],sp=new ep({start:!1,shift:(t,e)=>5==e||6==e||319==e?t:320==e,strict:!1}),ap=new Uf(((t,e)=>{let{next:n}=t;(125==n||-1==n||e.context)&&t.acceptToken(317)}),{contextual:!0,fallback:!0}),lp=new Uf(((t,e)=>{let n,{next:i}=t;op.indexOf(i)>-1||(47!=i||47!=(n=t.peek(1))&&42!=n)&&(125==i||59==i||-1==i||e.context||t.acceptToken(315))}),{contextual:!0}),cp=new Uf(((t,e)=>{91!=t.next||e.context||t.acceptToken(316)}),{contextual:!0}),Op=new Uf(((t,e)=>{let{next:n}=t;if(43==n||45==n){if(t.advance(),n==t.next){t.advance();let n=!e.context&&e.canShift(1);t.acceptToken(n?1:2)}}else 63==n&&46==t.peek(1)&&(t.advance(),t.advance(),(t.next<48||t.next>57)&&t.acceptToken(3))}),{contextual:!0});function hp(t,e){return t>=65&&t<=90||t>=97&&t<=122||95==t||t>=192||!e&&t>=48&&t<=57}const up=new Uf(((t,e)=>{if(60!=t.next||!e.dialectEnabled(0))return;if(t.advance(),47==t.next)return;let n=0;for(;op.indexOf(t.next)>-1;)t.advance(),n++;if(hp(t.next,!0)){for(t.advance(),n++;hp(t.next,!1);)t.advance(),n++;for(;op.indexOf(t.next)>-1;)t.advance(),n++;if(44==t.next)return;for(let e=0;;e++){if(7==e){if(!hp(t.next,!0))return;break}if(t.next!="extends".charCodeAt(e))break;t.advance(),n++}}t.acceptToken(4,-n)})),dp=Ha({"get set async static":yl.modifier,"for while do if else switch try catch finally return throw break continue default case":yl.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":yl.operatorKeyword,"let var const using function class extends":yl.definitionKeyword,"import export from":yl.moduleKeyword,"with debugger new":yl.keyword,TemplateString:yl.special(yl.string),super:yl.atom,BooleanLiteral:yl.bool,this:yl.self,null:yl.null,Star:yl.modifier,VariableName:yl.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":yl.function(yl.variableName),VariableDefinition:yl.definition(yl.variableName),Label:yl.labelName,PropertyName:yl.propertyName,PrivatePropertyName:yl.special(yl.propertyName),"CallExpression/MemberExpression/PropertyName":yl.function(yl.propertyName),"FunctionDeclaration/VariableDefinition":yl.function(yl.definition(yl.variableName)),"ClassDeclaration/VariableDefinition":yl.definition(yl.className),"NewExpression/VariableName":yl.className,PropertyDefinition:yl.definition(yl.propertyName),PrivatePropertyDefinition:yl.definition(yl.special(yl.propertyName)),UpdateOp:yl.updateOperator,"LineComment Hashbang":yl.lineComment,BlockComment:yl.blockComment,Number:yl.number,String:yl.string,Escape:yl.escape,ArithOp:yl.arithmeticOperator,LogicOp:yl.logicOperator,BitOp:yl.bitwiseOperator,CompareOp:yl.compareOperator,RegExp:yl.regexp,Equals:yl.definitionOperator,Arrow:yl.function(yl.punctuation),": Spread":yl.punctuation,"( )":yl.paren,"[ ]":yl.squareBracket,"{ }":yl.brace,"InterpolationStart InterpolationEnd":yl.special(yl.brace),".":yl.derefOperator,", ;":yl.separator,"@":yl.meta,TypeName:yl.typeName,TypeDefinition:yl.definition(yl.typeName),"type enum interface implements namespace module declare":yl.definitionKeyword,"abstract global Privacy readonly override":yl.modifier,"is keyof unique infer asserts":yl.operatorKeyword,JSXAttributeValue:yl.attributeValue,JSXText:yl.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":yl.angleBracket,"JSXIdentifier JSXNameSpacedName":yl.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":yl.attributeName,"JSXBuiltin/JSXIdentifier":yl.standard(yl.tagName)}),fp={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,for:474,of:483,while:486,with:490,do:494,if:498,else:500,switch:504,case:510,try:516,catch:520,finally:524,return:528,throw:532,break:536,continue:540,debugger:544},pp={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},mp={__proto__:null,"<":193},gp=np.deserialize({version:14,states:"$EOQ%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Ik'#IkO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JqO6[Q!0MxO'#JrO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?[#?b#@S#@f#@l#@r#AQ#Ag#C[#Cj#Cq#E]#Ek#G]#Gk#Gq#Gw#G}#HX#H_#He#Ho#IR#IXPPPPPPPPPPP#I_PPPPPPP#JS#MZ#Ns#Nz$ SPPP$&nP$&w$)p$0Z$0^$0a$1`$1c$1j$1rP$1x$1{P$2i$2m$3e$4s$4x$5`PP$5e$5k$5o$5r$5v$5z$6v$7_$7v$7z$7}$8Q$8W$8Z$8_$8cR!|RoqOXst!Z#d%l&p&r&s&u,n,s2S2VY!vQ'^-`1g5qQ%svQ%{yQ&S|Q&h!VS'U!e-WQ'd!iS'j!r!yU*h$|*X*lQ+l%|Q+y&UQ,_&bQ-^']Q-h'eQ-p'kQ0U*nQ1q,`R < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:379,context:sp,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,236,242,244,246,248,251,257,263,265,267,269,271,273,274,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[dp],skippedNodes:[0,5,6,277],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_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Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[lp,cp,Op,up,2,3,4,5,6,7,8,9,10,11,12,13,14,ap,new Df("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(b~~",141,339),new Df("j~RQYZXz{^~^O(P~~aP!P!Qd~iO(Q~~",25,322)],topRules:{Script:[0,7],SingleExpression:[1,275],SingleClassItem:[2,276]},dialects:{jsx:0,ts:15098},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:326,get:t=>fp[t]||-1},{term:342,get:t=>pp[t]||-1},{term:95,get:t=>mp[t]||-1}],tokenPrec:15124}),yp=[Ed("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),Ed("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),Ed("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Ed("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Ed("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),Ed("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Ed("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),Ed("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Ed("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),Ed('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Ed('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],vp=yp.concat([Ed("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Ed("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Ed("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),$p=new Ta,Qp=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Sp(t){return(e,n)=>{let i=e.node.getChild("VariableDefinition");return i&&n(i,t),!0}}const bp=["FunctionDeclaration"],wp={FunctionDeclaration:Sp("function"),ClassDeclaration:Sp("class"),ClassExpression:()=>!0,EnumDeclaration:Sp("constant"),TypeAliasDeclaration:Sp("type"),NamespaceDeclaration:Sp("namespace"),VariableDefinition(t,e){t.matchContext(bp)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function xp(t,e){let n=$p.get(e);if(n)return n;let i=[],r=!0;function o(e,n){let r=t.sliceString(e.from,e.to);i.push({label:r,type:n})}return e.cursor(Oa.IncludeAnonymous).iterate((e=>{if(r)r=!1;else if(e.name){let t=wp[e.name];if(t&&t(e,o)||Qp.has(e.name))return!1}else if(e.to-e.from>8192){for(let n of xp(t,e.node))i.push(n);return!1}})),$p.set(e,i),i}const Pp=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,_p=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function kp(t){let e=Pl(t.state).resolveInner(t.pos,-1);if(_p.indexOf(e.name)>-1)return null;let n="VariableName"==e.name||e.to-e.from<20&&Pp.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let i=[];for(let n=e;n;n=n.parent)Qp.has(n.name)&&(i=i.concat(xp(t.state.doc,n)));return{options:i,from:n?e.from:t.pos,validFor:Pp}}const Tp=xl.define({name:"javascript",parser:gp.configure({props:[Ml.add({IfStatement:Kl({except:/^\s*({|else\b)/}),TryStatement:Kl({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Hl,SwitchBody:t=>{let e=t.textAfter,n=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return t.baseIndent+(n?0:i?1:2)*t.unit},Block:Bl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":Kl({except:/^{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":t=>t.column(t.node.from)+t.unit}),tc.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":ec,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Rp={test:t=>/^JSX/.test(t.name),facet:Ql({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Xp=Tp.configure({dialect:"ts"},"typescript"),zp=Tp.configure({dialect:"jsx",props:[Sl.add((t=>t.isTop?[Rp]:void 0))]}),Cp=Tp.configure({dialect:"jsx ts",props:[Sl.add((t=>t.isTop?[Rp]:void 0))]},"typescript");let qp=t=>({label:t,type:"keyword"});const Ep="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(qp),Vp=Ep.concat(["declare","implements","private","protected","public"].map(qp));function Zp(t={}){let e=t.jsx?t.typescript?Cp:zp:t.typescript?Xp:Tp,n=t.typescript?vp.concat(Vp):yp.concat(Ep);return new Vl(e,[Tp.data.of({autocomplete:(i=_p,r=Eu(n),t=>{for(let e=Pl(t.state).resolveInner(t.pos,-1);e;e=e.parent){if(i.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return r(t)})}),Tp.data.of({autocomplete:kp}),t.jsx?Yp:[]]);var i,r}function Ap(t,e,n=t.length){for(let i=null==e?void 0:e.firstChild;i;i=i.nextSibling)if("JSXIdentifier"==i.name||"JSXBuiltin"==i.name||"JSXNamespacedName"==i.name||"JSXMemberExpression"==i.name)return t.sliceString(i.from,Math.min(i.to,n));return""}const Wp="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Yp=ao.inputHandler.of(((t,e,n,i,r)=>{if((Wp?t.composing:t.compositionStarted)||t.state.readOnly||e!=n||">"!=i&&"/"!=i||!Tp.isActiveAt(t.state,e,-1))return!1;let o=r(),{state:s}=o,a=s.changeByRange((t=>{var e;let n,{head:r}=t,o=Pl(s).resolveInner(r-1,-1);if("JSXStartTag"==o.name&&(o=o.parent),s.doc.sliceString(r-1,r)!=i||"JSXAttributeValue"==o.name&&o.to>r);else{if(">"==i&&"JSXFragmentTag"==o.name)return{range:t,changes:{from:r,insert:""}};if("/"==i&&"JSXStartCloseTag"==o.name){let t=o.parent,i=t.parent;if(i&&t.from==r-2&&((n=Ap(s.doc,i.firstChild,r))||"JSXFragmentTag"==(null===(e=i.firstChild)||void 0===e?void 0:e.name))){let t=`${n}>`;return{range:W.cursor(r+t.length,-1),changes:{from:r,insert:t}}}}else if(">"==i){let e=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if("JSXEscape"==t.name||!t.parent)return null;t=t.parent}}(o);if(e&&"JSXOpenTag"==e.name&&!/^\/?>|^<\//.test(s.doc.sliceString(r,r+2))&&(n=Ap(s.doc,e,r)))return{range:t,changes:{from:r,insert:``}}}}return{range:t}}));return!a.changes.empty&&(t.dispatch([o,s.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}));const Dp=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function Up(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Mp(t){return t>=48&&t<=57}const jp=new Uf(((t,e)=>{for(let n=!1,i=0,r=0;;r++){let{next:o}=t;if(Up(o)||45==o||95==o||n&&Mp(o))!n&&(45!=o||r>0)&&(n=!0),i===r&&45==o&&i++,t.advance();else{if(92!=o||10==t.peek(1)){n&&t.acceptToken(40==o?102:2==i&&e.canShift(2)?2:103);break}t.advance(),t.next>-1&&t.advance(),n=!0}}})),Lp=new Uf((t=>{if(Dp.includes(t.peek(-1))){let{next:e}=t;(Up(e)||95==e||35==e||46==e||91==e||58==e&&Up(t.peek(1))||45==e||38==e)&&t.acceptToken(101)}})),Ip=new Uf((t=>{if(!Dp.includes(t.peek(-1))){let{next:e}=t;if(37==e&&(t.advance(),t.acceptToken(1)),Up(e)){do{t.advance()}while(Up(t.next)||Mp(t.next));t.acceptToken(1)}}})),Np=Ha({"AtKeyword import charset namespace keyframes media supports":yl.definitionKeyword,"from to selector":yl.keyword,NamespaceName:yl.namespace,KeyframeName:yl.labelName,KeyframeRangeName:yl.operatorKeyword,TagName:yl.tagName,ClassName:yl.className,PseudoClassName:yl.constant(yl.className),IdName:yl.labelName,"FeatureName PropertyName":yl.propertyName,AttributeName:yl.attributeName,NumberLiteral:yl.number,KeywordQuery:yl.keyword,UnaryQueryOp:yl.operatorKeyword,"CallTag ValueName":yl.atom,VariableName:yl.variableName,Callee:yl.operatorKeyword,Unit:yl.unit,"UniversalSelector NestingSelector":yl.definitionOperator,MatchOp:yl.compareOperator,"ChildOp SiblingOp, LogicOp":yl.logicOperator,BinOp:yl.arithmeticOperator,Important:yl.modifier,Comment:yl.blockComment,ColorLiteral:yl.color,"ParenthesizedContent StringLiteral":yl.string,":":yl.punctuation,"PseudoOp #":yl.derefOperator,"; ,":yl.separator,"( )":yl.paren,"[ ]":yl.squareBracket,"{ }":yl.brace}),Gp={__proto__:null,lang:34,"nth-child":34,"nth-last-child":34,"nth-of-type":34,"nth-last-of-type":34,dir:34,"host-context":34,url:62,"url-prefix":62,domain:62,regexp:62,selector:140},Bp={__proto__:null,"@import":120,"@media":144,"@charset":148,"@namespace":152,"@keyframes":158,"@supports":170},Fp={__proto__:null,not:134,only:134},Hp=np.deserialize({version:14,states:":|QYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$[QXO'#CaO$fQ[O'#CiO$qQ[O'#DUO$vQ[O'#DXOOQP'#Eo'#EoO${QdO'#DhO%jQ[O'#DuO${QdO'#DwO%{Q[O'#DyO&WQ[O'#D|O&`Q[O'#ESO&nQ[O'#EUOOQS'#En'#EnOOQS'#EX'#EXQYQ[OOO&uQXO'#CdO'jQWO'#DdO'oQWO'#EtO'zQ[O'#EtQOQWOOP(UO#tO'#C_POOO)C@^)C@^OOQP'#Ch'#ChOOQP,59Q,59QO#kQ[O,59QO(aQ[O,59TO$qQ[O,59pO$vQ[O,59sO(lQ[O,59vO(lQ[O,59xO(lQ[O,59yO(lQ[O'#E^O)WQWO,58{O)`Q[O'#DcOOQS,58{,58{OOQP'#Cl'#ClOOQO'#DS'#DSOOQP,59T,59TO)gQWO,59TO)lQWO,59TOOQP'#DW'#DWOOQP,59p,59pOOQO'#DY'#DYO)qQ`O,59sOOQS'#Cq'#CqO${QdO'#CrO)yQvO'#CtO+ZQtO,5:SOOQO'#Cy'#CyO)lQWO'#CxO+oQWO'#CzO+tQ[O'#DPOOQS'#Eq'#EqOOQO'#Dk'#DkO+|Q[O'#DrO,[QWO'#EuO&`Q[O'#DpO,jQWO'#DsOOQO'#Ev'#EvO)ZQWO,5:aO,oQpO,5:cOOQS'#D{'#D{O,wQWO,5:eO,|Q[O,5:eOOQO'#EO'#EOO-UQWO,5:hO-ZQWO,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'S;=`%o<%lO%^bGoUp`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!cQp`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!UUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!T^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!SQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}",tokenizers:[Lp,Ip,jp,1,2,3,4,new Df("m~RRYZ[z{a~~g~aO#`~~dP!P!Qg~lO#a~~",28,107)],topRules:{StyleSheet:[0,4],Styles:[1,87]},specialized:[{term:102,get:t=>Gp[t]||-1},{term:59,get:t=>Bp[t]||-1},{term:103,get:t=>Fp[t]||-1}],tokenPrec:1246});let Kp=null;function Jp(){if(!Kp&&"object"==typeof document&&document.body){let{style:t}=document.body,e=[],n=new Set;for(let i in t)"cssText"!=i&&"cssFloat"!=i&&"string"==typeof t[i]&&(/[A-Z]/.test(i)&&(i=i.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))),n.has(i)||(e.push(i),n.add(i)));Kp=e.sort().map((t=>({type:"property",label:t,apply:t+": "})))}return Kp||[]}const tm=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((t=>({type:"class",label:t}))),em=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((t=>({type:"keyword",label:t}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((t=>({type:"constant",label:t})))),nm=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((t=>({type:"type",label:t}))),im=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map((t=>({type:"keyword",label:t}))),rm=/^(\w[\w-]*|-\w[\w-]*|)$/,om=/^-(-[\w-]*)?$/;const sm=new Ta,am=["Declaration"];function lm(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function cm(t,e,n){if(e.to-e.from>4096){let i=sm.get(e);if(i)return i;let r=[],o=new Set,s=e.cursor(Oa.IncludeAnonymous);if(s.firstChild())do{for(let e of cm(t,s.node,n))o.has(e.label)||(o.add(e.label),r.push(e))}while(s.nextSibling());return sm.set(e,r),r}{let i=[],r=new Set;return e.cursor().iterate((e=>{var o;if(n(e)&&e.matchContext(am)&&":"==(null===(o=e.node.nextSibling)||void 0===o?void 0:o.name)){let n=t.sliceString(e.from,e.to);r.has(n)||(r.add(n),i.push({label:n,type:"variable"}))}})),i}}const Om=t=>e=>{let{state:n,pos:i}=e,r=Pl(n).resolveInner(i,-1),o=r.type.isError&&r.from==r.to-1&&"-"==n.doc.sliceString(r.from,r.to);if("PropertyName"==r.name||(o||"TagName"==r.name)&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:Jp(),validFor:rm};if("ValueName"==r.name)return{from:r.from,options:em,validFor:rm};if("PseudoClassName"==r.name)return{from:r.from,options:tm,validFor:rm};if(t(r)||(e.explicit||o)&&function(t,e){var n;if(("("==t.name||t.type.isError)&&(t=t.parent||t),"ArgList"!=t.name)return!1;let i=null===(n=t.parent)||void 0===n?void 0:n.firstChild;return"Callee"==(null==i?void 0:i.name)&&"var"==e.sliceString(i.from,i.to)}(r,n.doc))return{from:t(r)||o?r.from:i,options:cm(n.doc,lm(r),t),validFor:om};if("TagName"==r.name){for(let{parent:t}=r;t;t=t.parent)if("Block"==t.name)return{from:r.from,options:Jp(),validFor:rm};return{from:r.from,options:nm,validFor:rm}}if("AtKeyword"==r.name)return{from:r.from,options:im,validFor:rm};if(!e.explicit)return null;let s=r.resolve(i),a=s.childBefore(i);return a&&":"==a.name&&"PseudoClassSelector"==s.name?{from:i,options:tm,validFor:rm}:a&&":"==a.name&&"Declaration"==s.name||"ArgList"==s.name?{from:i,options:em,validFor:rm}:"Block"==s.name||"Styles"==s.name?{from:i,options:Jp(),validFor:rm}:null},hm=Om((t=>"VariableName"==t.name)),um=xl.define({name:"css",parser:Hp.configure({props:[Ml.add({Declaration:Kl()}),tc.add({"Block KeyframeList":ec})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function dm(){return new Vl(um,um.data.of({autocomplete:hm}))}const fm=Ha({null:yl.null,instanceof:yl.operatorKeyword,this:yl.self,"new super assert open to with void":yl.keyword,"class interface extends implements enum var":yl.definitionKeyword,"module package import":yl.moduleKeyword,"switch while for if else case default do break continue return try catch finally throw":yl.controlKeyword,"requires exports opens uses provides public private protected static transitive abstract final strictfp synchronized native transient volatile throws":yl.modifier,IntegerLiteral:yl.integer,FloatingPointLiteral:yl.float,"StringLiteral TextBlock":yl.string,CharacterLiteral:yl.character,LineComment:yl.lineComment,BlockComment:yl.blockComment,BooleanLiteral:yl.bool,PrimitiveType:yl.standard(yl.typeName),TypeName:yl.typeName,Identifier:yl.variableName,"MethodName/Identifier":yl.function(yl.variableName),Definition:yl.definition(yl.variableName),ArithOp:yl.arithmeticOperator,LogicOp:yl.logicOperator,BitOp:yl.bitwiseOperator,CompareOp:yl.compareOperator,AssignOp:yl.definitionOperator,UpdateOp:yl.updateOperator,Asterisk:yl.punctuation,Label:yl.labelName,"( )":yl.paren,"[ ]":yl.squareBracket,"{ }":yl.brace,".":yl.derefOperator,", ;":yl.separator}),pm={__proto__:null,true:34,false:34,null:42,void:46,byte:48,short:48,int:48,long:48,char:48,float:48,double:48,boolean:48,extends:62,super:64,class:76,this:78,new:84,public:100,protected:102,private:104,abstract:106,static:108,final:110,strictfp:112,default:114,synchronized:116,native:118,transient:120,volatile:122,throws:150,implements:160,interface:166,enum:176,instanceof:238,open:267,module:269,requires:274,transitive:276,exports:278,to:280,opens:282,uses:284,provides:286,with:288,package:292,import:296,if:308,else:310,while:314,for:318,var:325,assert:332,switch:336,case:342,do:346,break:350,continue:354,return:358,throw:364,try:368,catch:372,finally:380},mm=np.deserialize({version:14,states:"##jQ]QPOOQ$wQPOOO(bQQO'#H^O*iQQO'#CbOOQO'#Cb'#CbO*p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'i'm'{'}(O(T(U(d(t)O)Q)R)])f)o)p*P*U*W*l*o*q*{*|+O+T+d+h+i+l+o+s+x,Y,^,`-^-r-t-}.R.X.g.m/O/[/_/b/d/e/n0Z0f0k0rR&P#Y$QjOcopx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%O%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o+s,Y,`-r-t-}.R.g.m/[/_/b/d/n0Z0f0kQ#f`Q&O#YQ'Y$YU)W%g'`'iQ)}&bQ*s'_Q,Q(tQ,j)oQ,k)pR.c,^Q)n%}R,i)m$SfO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%O%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o+s,Y,`-r-t-}.R.g.m/[/_/b/d/n0Z0f0kT&p#t,ZQ&|#xQ(P$oQ-u+hQ/]-tR0P/_]!nP!o'^*q-^/O#PaOPX`bcx![!f!o!y#_#e#l$_$m$n$o$p$q%O%b%d&]&i'^'e'h'{(U)O)Q)R*W*q+O+d+l+s+x,Y-[-^.R/O/dU#WY!W'|Q%T!eU&k#n#s+fQ(o%VS,s*T*zT.s,u-aj#UY!W!e#n#s%V%w&W)y*T*z,u-aU&V#`&`(}Q)x&[Q+e'|Q+q(`Q-s+fQ.O+rQ/g.WR0U/hQ)i%vQ,g)fR/o.mR,h)f`!jP!o'^'h*q+O-^/OT%W!g*|R%]!hW%U!e%V*z-aQ(z%^R,V({S#d`%bR&a#eQ)X%gT*t'`'iR*y'e[!lP!o'^*q-^/OR%X!gR#h`R,b)]R)a%kT-j+]-kQ/V-mR/z/WR/z/X",nodeNames:"⚠ LineComment BlockComment Program ModuleDeclaration MarkerAnnotation Identifier ScopedIdentifier . Annotation ) ( AnnotationArgumentList AssignmentExpression FieldAccess IntegerLiteral FloatingPointLiteral BooleanLiteral CharacterLiteral StringLiteral TextBlock null ClassLiteral void PrimitiveType TypeName ScopedTypeName GenericType TypeArguments AnnotatedType Wildcard extends super , ArrayType ] Dimension [ class this ParenthesizedExpression ObjectCreationExpression new ArgumentList } { ClassBody ; FieldDeclaration Modifiers public protected private abstract static final strictfp default synchronized native transient volatile VariableDeclarator Definition AssignOp ArrayInitializer MethodDeclaration TypeParameters TypeParameter TypeBound FormalParameters ReceiverParameter FormalParameter SpreadParameter Throws throws Block ClassDeclaration Superclass SuperInterfaces implements InterfaceTypeList InterfaceDeclaration interface ExtendsInterfaces InterfaceBody ConstantDeclaration EnumDeclaration enum EnumBody EnumConstant EnumBodyDeclarations AnnotationTypeDeclaration AnnotationTypeBody AnnotationTypeElementDeclaration StaticInitializer ConstructorDeclaration ConstructorBody ExplicitConstructorInvocation ArrayAccess MethodInvocation MethodName MethodReference ArrayCreationExpression Dimension AssignOp BinaryExpression CompareOp CompareOp LogicOp LogicOp BitOp BitOp BitOp ArithOp ArithOp ArithOp BitOp InstanceofExpression instanceof LambdaExpression InferredParameters TernaryExpression LogicOp : UpdateExpression UpdateOp UnaryExpression LogicOp BitOp CastExpression ElementValueArrayInitializer ElementValuePair open module ModuleBody ModuleDirective requires transitive exports to opens uses provides with PackageDeclaration package ImportDeclaration import Asterisk ExpressionStatement LabeledStatement Label IfStatement if else WhileStatement while ForStatement for ForSpec LocalVariableDeclaration var EnhancedForStatement ForSpec AssertStatement assert SwitchStatement switch SwitchBlock SwitchLabel case DoStatement do BreakStatement break ContinueStatement continue ReturnStatement return SynchronizedStatement ThrowStatement throw TryStatement try CatchClause catch CatchFormalParameter CatchType FinallyClause finally TryWithResourcesStatement ResourceSpecification Resource ClassContent",maxTerm:276,nodeProps:[["isolate",-4,1,2,18,19,""],["group",-26,4,47,76,77,82,87,92,145,147,150,151,153,156,158,161,163,165,167,172,174,176,178,180,181,183,191,"Statement",-25,6,13,14,15,16,17,18,19,20,21,22,39,40,41,99,100,102,103,106,118,120,122,125,127,130,"Expression",-7,23,24,25,26,27,29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ser:mm.configure({props:[Ml.add({IfStatement:Kl({except:/^\s*({|else\b)/}),TryStatement:Kl({except:/^\s*({|catch|finally)\b/}),LabeledStatement:Hl,SwitchBlock:t=>{let e=t.textAfter,n=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return t.baseIndent+(n?0:i?1:2)*t.unit},Block:Bl({closing:"}"}),BlockComment:()=>null,Statement:Kl({except:/^{/})}),tc.add({"Block SwitchBlock ClassBody ElementValueArrayInitializer ModuleBody EnumBody ConstructorBody InterfaceBody ArrayInitializer":ec,BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\})$/}});const ym={abstract:4,and:5,array:6,as:7,true:8,false:8,break:9,case:10,catch:11,clone:12,const:13,continue:14,declare:16,default:15,do:17,echo:18,else:19,elseif:20,enddeclare:21,endfor:22,endforeach:23,endif:24,endswitch:25,endwhile:26,enum:27,extends:28,final:29,finally:30,fn:31,for:32,foreach:33,from:34,function:35,global:36,goto:37,if:38,implements:39,include:40,include_once:41,instanceof:42,insteadof:43,interface:44,list:45,match:46,namespace:47,new:48,null:49,or:50,print:51,require:52,require_once:53,return:54,switch:55,throw:56,trait:57,try:58,unset:59,use:60,var:61,public:62,private:62,protected:62,while:63,xor:64,yield:65,__proto__:null};function vm(t){let e=ym[t.toLowerCase()];return null==e?-1:e}function $m(t){return 9==t||10==t||13==t||32==t}function Qm(t){return t>=97&&t<=122||t>=65&&t<=90}function Sm(t){return 95==t||t>=128||Qm(t)}function bm(t){return t>=48&&t<=55||t>=97&&t<=102||t>=65&&t<=70}const wm={int:!0,integer:!0,bool:!0,boolean:!0,float:!0,double:!0,real:!0,string:!0,array:!0,object:!0,unset:!0,__proto__:null},xm=new Uf((t=>{if(40==t.next){t.advance();let e=0;for(;$m(t.peek(e));)e++;let n,i="";for(;Qm(n=t.peek(e));)i+=String.fromCharCode(n),e++;for(;$m(t.peek(e));)e++;41==t.peek(e)&&wm[i.toLowerCase()]&&t.acceptToken(1)}else if(60==t.next&&60==t.peek(1)&&60==t.peek(2)){for(let e=0;e<3;e++)t.advance();for(;32==t.next||9==t.next;)t.advance();let e=39==t.next;if(e&&t.advance(),!Sm(t.next))return;let n=String.fromCharCode(t.next);for(;t.advance(),Sm(t.next)||t.next>=48&&t.next<=55;)n+=String.fromCharCode(t.next);if(e){if(39!=t.next)return;t.advance()}if(10!=t.next&&13!=t.next)return;for(;;){let e=10==t.next||13==t.next;if(t.advance(),t.next<0)return;if(e){for(;32==t.next||9==t.next;)t.advance();let e=!0;for(let i=0;i{t.next<0&&t.acceptToken(266)})),_m=new Uf(((t,e)=>{63==t.next&&e.canShift(265)&&62==t.peek(1)&&t.acceptToken(265)}));function km(t){let e=t.peek(1);if(110==e||114==e||116==e||118==e||101==e||102==e||92==e||36==e||34==e||123==e)return 2;if(e>=48&&e<=55){let e,n=2;for(;n<5&&(e=t.peek(n))>=48&&e<=55;)n++;return n}if(120==e&&bm(t.peek(2)))return bm(t.peek(3))?4:3;if(117==e&&123==t.peek(2))for(let e=3;;e++){let n=t.peek(e);if(125==n)return 2==e?0:e+1;if(!bm(n))break}return 0}const Tm=new Uf(((t,e)=>{let n=!1;for(;!(34==t.next||t.next<0||36==t.next&&(Sm(t.peek(1))||123==t.peek(1))||123==t.next&&36==t.peek(1));n=!0){if(92==t.next){let e=km(t);if(e){if(n)break;return t.acceptToken(3,e)}}else if(!n&&(91==t.next||45==t.next&&62==t.peek(1)&&Sm(t.peek(2))||63==t.next&&45==t.peek(1)&&62==t.peek(2)&&Sm(t.peek(3)))&&e.canShift(264))break;t.advance()}n&&t.acceptToken(263)})),Rm=Ha({"Visibility abstract final static":yl.modifier,"for foreach while do if else elseif switch try catch finally return throw break continue default case":yl.controlKeyword,"endif endfor endforeach endswitch endwhile declare enddeclare goto match":yl.controlKeyword,"and or xor yield unset clone instanceof insteadof":yl.operatorKeyword,"function fn class trait implements extends const enum global interface use var":yl.definitionKeyword,"include include_once require require_once namespace":yl.moduleKeyword,"new from echo print array list as":yl.keyword,null:yl.null,Boolean:yl.bool,VariableName:yl.variableName,"NamespaceName/...":yl.namespace,"NamedType/...":yl.typeName,Name:yl.name,"CallExpression/Name":yl.function(yl.variableName),"LabelStatement/Name":yl.labelName,"MemberExpression/Name":yl.propertyName,"MemberExpression/VariableName":yl.special(yl.propertyName),"ScopedExpression/ClassMemberName/Name":yl.propertyName,"ScopedExpression/ClassMemberName/VariableName":yl.special(yl.propertyName),"CallExpression/MemberExpression/Name":yl.function(yl.propertyName),"CallExpression/ScopedExpression/ClassMemberName/Name":yl.function(yl.propertyName),"MethodDeclaration/Name":yl.function(yl.definition(yl.variableName)),"FunctionDefinition/Name":yl.function(yl.definition(yl.variableName)),"ClassDeclaration/Name":yl.definition(yl.className),UpdateOp:yl.updateOperator,ArithOp:yl.arithmeticOperator,LogicOp:yl.logicOperator,BitOp:yl.bitwiseOperator,CompareOp:yl.compareOperator,ControlOp:yl.controlOperator,AssignOp:yl.definitionOperator,"$ ConcatOp":yl.operator,LineComment:yl.lineComment,BlockComment:yl.blockComment,Integer:yl.integer,Float:yl.float,String:yl.string,ShellExpression:yl.special(yl.string),"=> ->":yl.punctuation,"( )":yl.paren,"#[ [ ]":yl.squareBracket,"${ { }":yl.brace,"-> ?->":yl.derefOperator,", ; :: : \\":yl.separator,"PhpOpen PhpClose":yl.processingInstruction}),Xm={__proto__:null,static:311,STATIC:311,class:333,CLASS:333},zm=np.deserialize({version:14,states:"$GSQ`OWOOQhQaOOP%oO`OOOOO#t'#H_'#H_O%tO#|O'#DtOOO#u'#Dw'#DwQ&SOWO'#DwO&XO$VOOOOQ#u'#Dx'#DxO&lQaO'#D|O(mQdO'#E}O(tQdO'#EQO*kQaO'#EWO,zQ`O'#ETO-PQ`O'#E^O/nQaO'#E^O/uQ`O'#EfO/zQ`O'#EoO*kQaO'#EoO0VQ`O'#HhO0[Q`O'#E{O0[Q`O'#E{OOQS'#Ic'#IcO0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#Z#[#]#^#_#`#a#b$R$S$U$y%}&S'Y(O)p+P-z/x0e1R2[2]6x6yd+^(T)W+]+`+g,g,h,k.Q/O!t6w'U2^2_2`2a2b2c2d2e2f2g2h2i2j2k2l2m2n2o2p2s2t2u2v2w3P3d3g3h3k3o3p3s3z3|4O4Q4S4U5v5w!x;b3u3v3x3y3{3}4P4R4T4V4Z4a4b4c4d4e4f4g4h4i4j4k4l4m4n4o4p4q4r4s4t4u4v4w4x5Q5e5h5i5l5p5q5t$O=z_j!]!g#k#n#o#s#t%R%T&p&s&t&w'O'z(l({)P)i*P*U,V,X-R6^6_6`6a6b6c6d6e6f6g6h6i6j6k6l6m6n6o6p6q6r6s6t6u6v6z6{6|7X7l7o7r7w7|8T8U8X8Z8[8f8g8h8i#|>]!y!z!}%c&W)t)v*T*o,T-d-k.t/c/i/m0d0v4W6T7i7s7u7z8j8k8l8m8n8o8p8q8r8s8t8u8v8w8x8y8z8{8|8}9O9P9Q9R9S9T9Z9[9]9h9y9}:O:R:Y:Z:_:a:b;c;d=Z=m=n!v>^+z-Q9V9X:d:e:f:g:h:j:k:m:o:p:r:t:v:x:z:|;O;Q;S;U;W;Y;[;^;`;e;g;i;t_0V1]9W:i:l:n:q:s:u:w:y:{:};P;R;T;V;X;Z;];_;a;f;h;u AssignmentExpression ArrayExpression ValueList & VariadicUnpacking ... Pair [ ] ListExpression ValueList Pair Pair SubscriptExpression MemberExpression -> ?-> VariableName DynamicVariable $ ${ CallExpression ArgList NamedArgument SpreadArgument CastExpression UnionType LogicOp OptionalType NamedType QualifiedName \\ NamespaceName ScopedExpression :: ClassMemberName AssignOp UpdateExpression UpdateOp YieldExpression BinaryExpression LogicOp LogicOp LogicOp BitOp BitOp BitOp CompareOp CompareOp BitOp ArithOp ConcatOp ArithOp ArithOp IncludeExpression RequireExpression CloneExpression UnaryExpression ControlOp LogicOp PrintIntrinsic FunctionExpression static ParamList Parameter #[ Attributes Attribute VariadicParameter PropertyParameter UseList ArrowFunction NewExpression class BaseClause ClassInterfaceClause DeclarationList ConstDeclaration VariableDeclarator PropertyDeclaration VariableDeclarator MethodDeclaration UseDeclaration UseList UseInsteadOfClause UseAsClause UpdateExpression ArithOp ShellExpression ThrowExpression Integer Float String MemberExpression SubscriptExpression UnaryExpression ArithOp Interpolation String IfStatement ColonBlock SwitchStatement Block CaseStatement DefaultStatement ColonBlock WhileStatement EmptyStatement DoStatement ForStatement ForSpec SequenceExpression ForeachStatement ForSpec Pair GotoStatement ContinueStatement BreakStatement ReturnStatement TryStatement CatchDeclarator DeclareStatement EchoStatement UnsetStatement ConstDeclaration FunctionDefinition ClassDeclaration InterfaceDeclaration TraitDeclaration EnumDeclaration EnumBody EnumCase NamespaceDefinition NamespaceUseDeclaration UseGroup UseClause UseClause GlobalDeclaration FunctionStaticDeclaration Program",maxTerm:304,nodeProps:[["group",-36,2,8,49,81,83,85,88,93,94,102,106,107,110,111,114,118,123,126,130,132,133,147,148,149,150,153,154,164,165,179,181,182,183,184,185,191,"Expression",-28,74,78,80,82,192,194,199,201,202,205,208,209,210,211,212,214,215,216,217,218,219,220,221,222,225,226,230,231,"Statement",-3,119,121,122,"Type"],["isolate",-4,66,67,70,191,""],["openedBy",69,"phpOpen",76,"{",86,"(",101,"#["],["closedBy",71,"phpClose",77,"}",87,")",158,"]"]],propSources:[Rm],skippedNodes:[0],repeatNodeCount:29,tokenData:"!F|_R!]OX$zXY&^YZ'sZ]$z]^&^^p$zpq&^qr)Rrs+Pst+otu2buv5evw6rwx8Vxy>]yz>yz{?g{|@}|}Bb}!OCO!O!PDh!P!QKT!Q!R!!o!R![!$q![!]!,P!]!^!-a!^!_!-}!_!`!1S!`!a!2d!a!b!3t!b!c!7^!c!d!7z!d!e!9W!e!}!7z!}#O!;^#O#P!;z#P#Q!V<%lO8VR9WV&wP%VQOw9mwx:Xx#O9m#O#P:^#P;'S9m;'S;=`;X<%lO9mQ9rV%VQOw9mwx:Xx#O9m#O#P:^#P;'S9m;'S;=`;X<%lO9mQ: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:[0,72],Program:[1,232]},dynamicPrecedences:{284:1},specialized:[{term:81,get:(t,e)=>vm(t)<<1,external:vm},{term:81,get:t=>Xm[t]||-1}],tokenPrec:29354}),Cm={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},qm={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Em={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Vm(t){return 9==t||10==t||13==t||32==t}let Zm=null,Am=null,Wm=0;function Ym(t,e){let n=t.pos+e;if(Wm==n&&Am==t)return Zm;let i=t.peek(e);for(;Vm(i);)i=t.peek(++e);let r="";for(;45==(o=i)||46==o||58==o||o>=65&&o<=90||95==o||o>=97&&o<=122||o>=161;)r+=String.fromCharCode(i),i=t.peek(++e);var o;return Am=t,Wm=n,Zm=r?r.toLowerCase():i==Dm||i==Um?void 0:null}const Dm=63,Um=33;function Mm(t,e){this.name=t,this.parent=e}const jm=[6,10,7,8,9],Lm=new ep({start:null,shift:(t,e,n,i)=>jm.indexOf(e)>-1?new Mm(Ym(i,1)||"",t):t,reduce:(t,e)=>20==e&&t?t.parent:t,reuse(t,e,n,i){let r=e.type.id;return 6==r||36==r?new Mm(Ym(i,1)||"",t):t},strict:!1}),Im=new Uf(((t,e)=>{if(60!=t.next)return void(t.next<0&&e.context&&t.acceptToken(57));t.advance();let n=47==t.next;n&&t.advance();let i=Ym(t,0);if(void 0===i)return;if(!i)return t.acceptToken(n?14:6);let r=e.context?e.context.name:null;if(n){if(i==r)return t.acceptToken(11);if(r&&qm[r])return t.acceptToken(57,-2);if(e.dialectEnabled(0))return t.acceptToken(12);for(let t=e.context;t;t=t.parent)if(t.name==i)return;t.acceptToken(13)}else{if("script"==i)return t.acceptToken(7);if("style"==i)return t.acceptToken(8);if("textarea"==i)return t.acceptToken(9);if(Cm.hasOwnProperty(i))return t.acceptToken(10);r&&Em[r]&&Em[r][i]?t.acceptToken(57,-1):t.acceptToken(6)}}),{contextual:!0}),Nm=new Uf((t=>{for(let e=0,n=0;;n++){if(t.next<0){n&&t.acceptToken(58);break}if(45==t.next)e++;else{if(62==t.next&&e>=2){n>=3&&t.acceptToken(58,-2);break}e=0}t.advance()}}));const Gm=new Uf(((t,e)=>{if(47==t.next&&62==t.peek(1)){let n=e.dialectEnabled(1)||function(t){for(;t;t=t.parent)if("svg"==t.name||"math"==t.name)return!0;return!1}(e.context);t.acceptToken(n?5:4,2)}else 62==t.next&&t.acceptToken(4,1)}));function Bm(t,e,n){let i=2+t.length;return new Uf((r=>{for(let o=0,s=0,a=0;;a++){if(r.next<0){a&&r.acceptToken(e);break}if(0==o&&60==r.next||1==o&&47==r.next||o>=2&&os?r.acceptToken(e,-s):r.acceptToken(n,-(s-2));break}if((10==r.next||13==r.next)&&a){r.acceptToken(e,1);break}o=s=0}else s++;r.advance()}}))}const Fm=Bm("script",54,1),Hm=Bm("style",55,2),Km=Bm("textarea",56,3),Jm=Ha({"Text RawText":yl.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":yl.angleBracket,TagName:yl.tagName,"MismatchedCloseTag/TagName":[yl.tagName,yl.invalid],AttributeName:yl.attributeName,"AttributeValue UnquotedAttributeValue":yl.attributeValue,Is:yl.definitionOperator,"EntityReference CharacterReference":yl.character,Comment:yl.blockComment,ProcessingInst:yl.processingInstruction,DoctypeDecl:yl.documentMeta}),tg=np.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%ZQ&rO,59fO%fQ&rO,59iO%qQ&rO,59lO%|Q&rO,59nOOOa'#D^'#D^O&XOaO'#CxO&dOaO,59[OOOb'#D_'#D_O&lObO'#C{O&wObO,59[OOOd'#D`'#D`O'POdO'#DOO'[OdO,59[OOO`'#Da'#DaO'dO!rO,59[O'kQ#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'pO$fO,59oOOO`,59o,59oO'xQ#|O,59qO'}Q#|O,59rOOO`-E7W-E7WO(SQ&rO'#CsOOQW'#DZ'#DZO(bQ&rO1G.wOOOa1G.w1G.wOOO`1G/Y1G/YO(mQ&rO1G/QOOOb1G/Q1G/QO(xQ&rO1G/TOOOd1G/T1G/TO)TQ&rO1G/WOOO`1G/W1G/WO)`Q&rO1G/YOOOa-E7[-E7[O)kQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)pQ#tO'#C|OOOd-E7^-E7^O)uQ#tO'#DPOOO`-E7_-E7_O)zQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O*PQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOO`7+$t7+$tOOOb7+$l7+$lOOOd7+$o7+$oOOO`7+$r7+$rO*[Q#|O,59eO*aQ#|O,59hO*fQ#|O,59kOOO`1G/X1G/XO*kO7[O'#CvO*|OMhO'#CvOOQW1G.y1G.yOOO`1G/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mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:Lm,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"],["isolate",-11,21,29,30,32,33,35,36,37,38,41,42,"ltr",-3,26,27,39,""]],propSources:[Jm],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zbkWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOa!R!R7tP;=`<%l7S!Z8OYkWa!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{ihSkWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S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t;'S;=`!;r<%lO!4t!R!;]V!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let a=t.type.id;if(28==a)return ig(t,e,n);if(31==a)return ig(t,e,i);if(34==a)return ig(t,e,r);if(20==a&&o.length){let n,i=t.node,r=i.firstChild,s=r&&ng(r,e);if(s)for(let t of o)if(t.tag==s&&(!t.attrs||t.attrs(n||(n=eg(r,e))))){let e=i.lastChild,n=37==e.type.id?e.from:i.to;if(n>r.to)return{parser:t.parser,overlay:[{from:r.to,to:n}]}}}if(s&&23==a){let n,i=t.node;if(n=i.firstChild){let t=s[e.read(n.from,n.to)];if(t)for(let n of t){if(n.tagName&&n.tagName!=ng(i.parent,e))continue;let t=i.lastChild;if(26==t.type.id){let e=t.from+1,i=t.lastChild,r=t.to-(i&&i.isError?0:1);if(r>e)return{parser:n.parser,overlay:[{from:e,to:r}]}}else if(27==t.type.id)return{parser:n.parser,overlay:[{from:t.from,to:t.to}]}}}}return null}))}const og=["_blank","_self","_top","_parent"],sg=["ascii","utf-8","utf-16","latin1","latin1"],ag=["get","post","put","delete"],lg=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],cg=["true","false"],Og={},hg={a:{attrs:{href:null,ping:null,type:null,media:null,target:og,hreflang:null}},abbr:Og,address:Og,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Og,aside:Og,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Og,base:{attrs:{href:null,target:og}},bdi:Og,bdo:Og,blockquote:{attrs:{cite:null}},body:Og,br:Og,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:lg,formmethod:ag,formnovalidate:["novalidate"],formtarget:og,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Og,center:Og,cite:Og,code:Og,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Og,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Og,div:Og,dl:Og,dt:Og,em:Og,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Og,figure:Og,footer:Og,form:{attrs:{action:null,name:null,"accept-charset":sg,autocomplete:["on","off"],enctype:lg,method:ag,novalidate:["novalidate"],target:og}},h1:Og,h2:Og,h3:Og,h4:Og,h5:Og,h6:Og,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Og,hgroup:Og,hr:Og,html:{attrs:{manifest:null}},i:Og,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:lg,formmethod:ag,formnovalidate:["novalidate"],formtarget:og,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Og,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Og,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Og,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:sg,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Og,noscript:Og,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Og,param:{attrs:{name:null,value:null}},pre:Og,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Og,rt:Og,ruby:Og,samp:Og,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:sg}},section:Og,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Og,source:{attrs:{src:null,type:null,media:null}},span:Og,strong:Og,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Og,summary:Og,sup:Og,table:Og,tbody:Og,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Og,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Og,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Og,time:{attrs:{datetime:null}},title:Og,tr:Og,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Og,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Og},ug={accesskey:null,class:null,contenteditable:cg,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:cg,autocorrect:cg,autocapitalize:cg,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":cg,"aria-autocomplete":["inline","list","both","none"],"aria-busy":cg,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":cg,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":cg,"aria-hidden":cg,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":cg,"aria-multiselectable":cg,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":cg,"aria-relevant":null,"aria-required":cg,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},dg="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((t=>"on"+t));for(let t of dg)ug[t]=null;class fg{constructor(t,e){this.tags=Object.assign(Object.assign({},hg),t),this.globalAttrs=Object.assign(Object.assign({},ug),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}function pg(t,e,n=t.length){if(!e)return"";let i=e.firstChild,r=i&&i.getChild("TagName");return r?t.sliceString(r.from,Math.min(r.to,n)):""}function mg(t,e=!1){for(;t;t=t.parent)if("Element"==t.name){if(!e)return t;e=!1}return null}function gg(t,e,n){let i=n.tags[pg(t,mg(e))];return(null==i?void 0:i.children)||n.allTags}function yg(t,e){let n=[];for(let i=mg(e);i&&!i.type.isTop;i=mg(i.parent)){let r=pg(t,i);if(r&&"CloseTag"==i.lastChild.name)break;r&&n.indexOf(r)<0&&("EndTag"==e.name||e.from>=i.firstChild.to)&&n.push(r)}return n}fg.default=new fg;const vg=/^[:\-\.\w\u00b7-\uffff]*$/;function $g(t,e,n,i,r){let o=/\s*>/.test(t.sliceDoc(r,r+5))?"":">",s=mg(n,!0);return{from:i,to:r,options:gg(t.doc,s,e).map((t=>({label:t,type:"type"}))).concat(yg(t.doc,n).map(((t,e)=>({label:"/"+t,apply:"/"+t+o,type:"type",boost:99-e})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Qg(t,e,n,i){let r=/\s*>/.test(t.sliceDoc(i,i+5))?"":">";return{from:n,to:i,options:yg(t.doc,e).map(((t,e)=>({label:t,apply:t+r,type:"type",boost:99-e}))),validFor:vg}}function Sg(t,e){let{state:n,pos:i}=e,r=Pl(n).resolveInner(i,-1),o=r.resolve(i);for(let t,e=i;o==r&&(t=r.childBefore(e));){let n=t.lastChild;if(!n||!n.type.isError||n.from({label:t,type:"property"}))),validFor:vg}}(n,t,r,"AttributeName"==r.name?r.from:i,i):"Is"==r.name||"AttributeValue"==r.name||"UnquotedAttributeValue"==r.name?function(t,e,n,i,r){var o;let s,a=null===(o=n.parent)||void 0===o?void 0:o.getChild("AttributeName"),l=[];if(a){let o=t.sliceDoc(a.from,a.to),c=e.globalAttrs[o];if(!c){let i=mg(n),r=i?e.tags[pg(t.doc,i)]:null;c=(null==r?void 0:r.attrs)&&r.attrs[o]}if(c){let e=t.sliceDoc(i,r).toLowerCase(),n='"',o='"';/^['"]/.test(e)?(s='"'==e[0]?/^[^"]*$/:/^[^']*$/,n="",o=t.sliceDoc(r,r+1)==e[0]?"":e[0],e=e.slice(1),i++):s=/^[^\s<>='"]*$/;for(let t of c)l.push({label:t,apply:n+t+o,type:"constant"})}}return{from:i,to:r,options:l,validFor:s}}(n,t,r,"Is"==r.name?i:r.from,i):!e.explicit||"Element"!=o.name&&"Text"!=o.name&&"Document"!=o.name?null:function(t,e,n,i){let r=[],o=0;for(let i of gg(t.doc,n,e))r.push({label:"<"+i,type:"type"});for(let e of yg(t.doc,n))r.push({label:"",type:"type",boost:99-o++});return{from:i,to:i,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}(n,t,r,i)}function bg(t){let{extraTags:e,extraGlobalAttributes:n}=t,i=n||e?new fg(e,n):fg.default;return t=>Sg(i,t)}const wg=Tp.parser.configure({top:"SingleExpression"}),xg=[{tag:"script",attrs:t=>"text/typescript"==t.type||"ts"==t.lang,parser:Xp.parser},{tag:"script",attrs:t=>"text/babel"==t.type||"text/jsx"==t.type,parser:zp.parser},{tag:"script",attrs:t=>"text/typescript-jsx"==t.type,parser:Cp.parser},{tag:"script",attrs:t=>/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type),parser:wg},{tag:"script",attrs:t=>!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type),parser:Tp.parser},{tag:"style",attrs:t=>(!t.lang||"css"==t.lang)&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type)),parser:um.parser}],Pg=[{name:"style",parser:um.parser.configure({top:"Styles"})}].concat(dg.map((t=>({name:t,parser:Tp.parser})))),_g=xl.define({name:"html",parser:tg.configure({props:[Ml.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag":t=>t.column(t.node.from)+t.unit,Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),kg=_g.configure({wrap:rg(xg,Pg)});const Tg=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Rg=ao.inputHandler.of(((t,e,n,i,r)=>{if(t.composing||t.state.readOnly||e!=n||">"!=i&&"/"!=i||!kg.isActiveAt(t.state,e,-1))return!1;let o=r(),{state:s}=o,a=s.changeByRange((t=>{var e,n,r;let o,a=s.doc.sliceString(t.from-1,t.to)==i,{head:l}=t,c=Pl(s).resolveInner(l,-1);if(a&&">"==i&&"EndTag"==c.name){let i=c.parent;if("CloseTag"!=(null===(n=null===(e=i.parent)||void 0===e?void 0:e.lastChild)||void 0===n?void 0:n.name)&&(o=pg(s.doc,i.parent,l))&&!Tg.has(o)){return{range:t,changes:{from:l,to:l+(">"===s.doc.sliceString(l,l+1)?1:0),insert:``}}}}else if(a&&"/"==i&&"IncompleteCloseTag"==c.name){let t=c.parent;if(c.from==l-2&&"CloseTag"!=(null===(r=t.lastChild)||void 0===r?void 0:r.name)&&(o=pg(s.doc,t,l))&&!Tg.has(o)){let t=l+(">"===s.doc.sliceString(l,l+1)?1:0),e=`${o}>`;return{range:W.cursor(l+e.length,-1),changes:{from:l,to:t,insert:e}}}}return{range:t}}));return!a.changes.empty&&(t.dispatch([o,s.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)})),Xg=xl.define({name:"php",parser:zm.configure({props:[Ml.add({IfStatement:Kl({except:/^\s*({|else\b|elseif\b|endif\b)/}),TryStatement:Kl({except:/^\s*({|catch\b|finally\b)/}),SwitchBody:t=>{let e=t.textAfter,n=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return t.baseIndent+(n?0:i?1:2)*t.unit},ColonBlock:t=>t.baseIndent+t.unit,"Block EnumBody DeclarationList":Bl({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"String BlockComment":()=>null,Statement:Kl({except:/^({|end(for|foreach|switch|while)\b)/})}),tc.add({"Block EnumBody DeclarationList SwitchBody ArrayExpression ValueList":ec,ColonBlock:t=>({from:t.from+1,to:t.to}),BlockComment:t=>({from:t.from+2,to:t.to-2})})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"},line:"//"},indentOnInput:/^\s*(?:case |default:|end(?:if|for(?:each)?|switch|while)|else(?:if)?|\{|\})$/,wordChars:"$",closeBrackets:{stringPrefixes:["b","B"]}}});var zg=n(726);window._=n(543);try{window.$=window.jQuery=n(692),n(754)}catch(t){}window.axios=n(425),window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";var Cg=document.head.querySelector('meta[name="csrf-token"]');Cg?window.axios.defaults.headers.common["X-CSRF-TOKEN"]=Cg.content:console.error("CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token"),window.tempusDominus=n(969),window.Sortable=n(246).Ay,window.EditorView=ao,window.placeholder=function(t){return li.fromClass(class{constructor(e){this.view=e,this.placeholder=t?hn.set([hn.widget({widget:new Ko(t),side:1}).range(0)]):hn.none}get decorations(){return this.view.state.doc.length?hn.none:this.placeholder}},{decorations:t=>t.decorations})},window.basicSetup=Rf,window.javascript=Zp,window.css=dm,window.java=function(){return new Vl(gm)},window.php=function(t={}){let e,n=[];if(null===t.baseLanguage);else if(t.baseLanguage)e=t.baseLanguage;else{let t=function(t={}){let e,n="";!1===t.matchClosingTags&&(n="noMatch"),!0===t.selfClosingTags&&(n=(n?n+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(e=rg((t.nestedLanguages||[]).concat(xg),(t.nestedAttributes||[]).concat(Pg)));let i=e?_g.configure({wrap:e,dialect:n}):n?kg.configure({dialect:n}):kg;return new Vl(i,[kg.data.of({autocomplete:bg(t)}),!1!==t.autoCloseTags?Rg:[],Zp().support,dm().support])}({matchClosingTags:!1});n.push(t.support),e=t.language}return new Vl(Xg.configure({wrap:e&&Ca((t=>t.type.isTop?{parser:e.parser,overlay:t=>"Text"==t.name}:null)),top:t.plain?"Program":"Template"}),n)},window.createApp=zg.Ef;var qg=n(353),Eg=n(826),Vg=n(569);qg.extend(Eg),qg.extend(Vg),window.dayjs=qg},246:(t,e,n)=>{"use strict";function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function r(t){for(var e=1;e=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}n.d(e,{Ay:()=>ae});function c(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var O=c(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),h=c(/Edge/i),u=c(/firefox/i),d=c(/safari/i)&&!c(/chrome/i)&&!c(/android/i),f=c(/iP(ad|od|hone)/i),p=c(/chrome/i)&&c(/android/i),m={capture:!1,passive:!1};function g(t,e,n){t.addEventListener(e,n,!O&&m)}function y(t,e,n){t.removeEventListener(e,n,!O&&m)}function v(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function $(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Q(t,e,n,i){if(t){n=n||document;do{if(null!=e&&(">"===e[0]?t.parentNode===n&&v(t,e):v(t,e))||i&&t===n)return t;if(t===n)break}while(t=$(t))}return null}var S,b=/\s+/g;function w(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var i=(" "+t.className+" ").replace(b," ").replace(" "+e+" "," ");t.className=(i+(n?" "+e:"")).replace(b," ")}}function x(t,e,n){var i=t&&t.style;if(i){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in i||-1!==e.indexOf("webkit")||(e="-webkit-"+e),i[e]=n+("string"==typeof n?"":"px")}}function P(t,e){var n="";if("string"==typeof t)n=t;else do{var i=x(t,"transform");i&&"none"!==i&&(n=i+" "+n)}while(!e&&(t=t.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function _(t,e,n){if(t){var i=t.getElementsByTagName(e),r=0,o=i.length;if(n)for(;r=o:r<=o))return i;if(i===k())break;i=E(i,!1)}return!1}function X(t,e,n,i){for(var r=0,o=0,s=t.children;o2&&void 0!==arguments[2]?arguments[2]:{},i=n.evt,o=l(n,N);L.pluginEvent.bind(Yt)(t,e,r({dragEl:F,parentEl:H,ghostEl:K,rootEl:J,nextEl:tt,lastDownEl:et,cloneEl:nt,cloneHidden:it,dragStarted:mt,putSortable:ct,activeSortable:Yt.active,originalEvent:i,oldIndex:rt,oldDraggableIndex:st,newIndex:ot,newDraggableIndex:at,hideGhostForTarget:Vt,unhideGhostForTarget:Zt,cloneNowHidden:function(){it=!0},cloneNowShown:function(){it=!1},dispatchSortableEvent:function(t){B({sortable:e,name:t,originalEvent:i})}},o))};function B(t){I(r({putSortable:ct,cloneEl:nt,targetEl:F,rootEl:J,oldIndex:rt,oldDraggableIndex:st,newIndex:ot,newDraggableIndex:at},t))}var F,H,K,J,tt,et,nt,it,rt,ot,st,at,lt,ct,Ot,ht,ut,dt,ft,pt,mt,gt,yt,vt,$t,Qt=!1,St=!1,bt=[],wt=!1,xt=!1,Pt=[],_t=!1,kt=[],Tt="undefined"!=typeof document,Rt=f,Xt=h||O?"cssFloat":"float",zt=Tt&&!p&&!f&&"draggable"in document.createElement("div"),Ct=function(){if(Tt){if(O)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),qt=function(t,e){var n=x(t),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),r=X(t,0,e),o=X(t,1,e),s=r&&x(r),a=o&&x(o),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+T(r).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+T(o).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&s.float&&"none"!==s.float){var O="left"===s.float?"left":"right";return!o||"both"!==a.clear&&a.clear!==O?"horizontal":"vertical"}return r&&("block"===s.display||"flex"===s.display||"table"===s.display||"grid"===s.display||l>=i&&"none"===n[Xt]||o&&"none"===n[Xt]&&l+c>i)?"vertical":"horizontal"},Et=function(t){function e(t,n){return function(i,r,o,s){var a=i.options.group.name&&r.options.group.name&&i.options.group.name===r.options.group.name;if(null==t&&(n||a))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"==typeof t)return e(t(i,r,o,s),n)(i,r,o,s);var l=(n?i:r).options.group.name;return!0===t||"string"==typeof t&&t===l||t.join&&t.indexOf(l)>-1}}var n={},i=t.group;i&&"object"==o(i)||(i={name:i}),n.name=i.name,n.checkPull=e(i.pull,!0),n.checkPut=e(i.put),n.revertClone=i.revertClone,t.group=n},Vt=function(){!Ct&&K&&x(K,"display","none")},Zt=function(){!Ct&&K&&x(K,"display","")};Tt&&!p&&document.addEventListener("click",(function(t){if(St)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),St=!1,!1}),!0);var At=function(t){if(F){t=t.touches?t.touches[0]:t;var e=(r=t.clientX,o=t.clientY,bt.some((function(t){var e=t[D].options.emptyInsertThreshold;if(e&&!z(t)){var n=T(t),i=r>=n.left-e&&r<=n.right+e,a=o>=n.top-e&&o<=n.bottom+e;return i&&a?s=t:void 0}})),s);if(e){var n={};for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[D]._onDragOver(n)}}var r,o,s},Wt=function(t){F&&F.parentNode[D]._isOutsideThisEl(t.target)};function Yt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=a({},e),t[D]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return qt(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Yt.supportPointer&&"PointerEvent"in window&&(!d||f),emptyInsertThreshold:5};for(var i in L.initializePlugins(this,t,n),n)!(i in e)&&(e[i]=n[i]);for(var r in Et(e),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!e.forceFallback&&zt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?g(t,"pointerdown",this._onTapStart):(g(t,"mousedown",this._onTapStart),g(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(g(t,"dragover",this),g(t,"dragenter",this)),bt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),a(this,U())}function Dt(t,e,n,i,r,o,s,a){var l,c,u=t[D],d=u.options.onMove;return!window.CustomEvent||O||h?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=e,l.from=t,l.dragged=n,l.draggedRect=i,l.related=r||e,l.relatedRect=o||T(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),d&&(c=d.call(u,l,s)),c}function Ut(t){t.draggable=!1}function Mt(){_t=!1}function jt(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,i=0;n--;)i+=e.charCodeAt(n);return i.toString(36)}function Lt(t){return setTimeout(t,0)}function It(t){return clearTimeout(t)}Yt.prototype={constructor:Yt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(gt=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,F):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,i=this.options,r=i.preventOnFilter,o=t.type,s=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=i.filter;if(function(t){kt.length=0;var e=t.getElementsByTagName("input"),n=e.length;for(;n--;){var i=e[n];i.checked&&kt.push(i)}}(n),!F&&!(/mousedown|pointerdown/.test(o)&&0!==t.button||i.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!d||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=Q(a,i.draggable,n,!1))&&a.animated||et===a)){if(rt=C(a),st=C(a,i.draggable),"function"==typeof c){if(c.call(this,t,a,this))return B({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),G("filter",e,{evt:t}),void(r&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(i){if(i=Q(l,i.trim(),n,!1))return B({sortable:e,rootEl:i,name:"filter",targetEl:a,fromEl:n,toEl:n}),G("filter",e,{evt:t}),!0}))))return void(r&&t.preventDefault());i.handle&&!Q(l,i.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var i,r=this,o=r.el,s=r.options,a=o.ownerDocument;if(n&&!F&&n.parentNode===o){var l=T(n);if(J=o,H=(F=n).parentNode,tt=F.nextSibling,et=n,lt=s.group,Yt.dragged=F,Ot={target:F,clientX:(e||t).clientX,clientY:(e||t).clientY},ft=Ot.clientX-l.left,pt=Ot.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,F.style["will-change"]="all",i=function(){G("delayEnded",r,{evt:t}),Yt.eventCanceled?r._onDrop():(r._disableDelayedDragEvents(),!u&&r.nativeDraggable&&(F.draggable=!0),r._triggerDragStart(t,e),B({sortable:r,name:"choose",originalEvent:t}),w(F,s.chosenClass,!0))},s.ignore.split(",").forEach((function(t){_(F,t.trim(),Ut)})),g(a,"dragover",At),g(a,"mousemove",At),g(a,"touchmove",At),s.supportPointer?(g(a,"pointerup",r._onDrop),!this.nativeDraggable&&g(a,"pointercancel",r._onDrop)):(g(a,"mouseup",r._onDrop),g(a,"touchend",r._onDrop),g(a,"touchcancel",r._onDrop)),u&&this.nativeDraggable&&(this.options.touchStartThreshold=4,F.draggable=!0),G("delayStart",this,{evt:t}),!s.delay||s.delayOnTouchOnly&&!e||this.nativeDraggable&&(h||O))i();else{if(Yt.eventCanceled)return void this._onDrop();s.supportPointer?(g(a,"pointerup",r._disableDelayedDrag),g(a,"pointercancel",r._disableDelayedDrag)):(g(a,"mouseup",r._disableDelayedDrag),g(a,"touchend",r._disableDelayedDrag),g(a,"touchcancel",r._disableDelayedDrag)),g(a,"mousemove",r._delayedDragTouchMoveHandler),g(a,"touchmove",r._delayedDragTouchMoveHandler),s.supportPointer&&g(a,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(i,s.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){F&&Ut(F),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;y(t,"mouseup",this._disableDelayedDrag),y(t,"touchend",this._disableDelayedDrag),y(t,"touchcancel",this._disableDelayedDrag),y(t,"pointerup",this._disableDelayedDrag),y(t,"pointercancel",this._disableDelayedDrag),y(t,"mousemove",this._delayedDragTouchMoveHandler),y(t,"touchmove",this._delayedDragTouchMoveHandler),y(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?g(document,"pointermove",this._onTouchMove):g(document,e?"touchmove":"mousemove",this._onTouchMove):(g(F,"dragend",this),g(J,"dragstart",this._onDragStart));try{document.selection?Lt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(Qt=!1,J&&F){G("dragStarted",this,{evt:e}),this.nativeDraggable&&g(document,"dragover",Wt);var n=this.options;!t&&w(F,n.dragClass,!1),w(F,n.ghostClass,!0),Yt.active=this,t&&this._appendGhost(),B({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(ht){this._lastX=ht.clientX,this._lastY=ht.clientY,Vt();for(var t=document.elementFromPoint(ht.clientX,ht.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(ht.clientX,ht.clientY))!==e;)e=t;if(F.parentNode[D]._isOutsideThisEl(t),e)do{if(e[D]){if(e[D]._onDragOver({clientX:ht.clientX,clientY:ht.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=$(e));Zt()}},_onTouchMove:function(t){if(Ot){var e=this.options,n=e.fallbackTolerance,i=e.fallbackOffset,r=t.touches?t.touches[0]:t,o=K&&P(K,!0),s=K&&o&&o.a,a=K&&o&&o.d,l=Rt&&$t&&q($t),c=(r.clientX-Ot.clientX+i.x)/(s||1)+(l?l[0]-Pt[0]:0)/(s||1),O=(r.clientY-Ot.clientY+i.y)/(a||1)+(l?l[1]-Pt[1]:0)/(a||1);if(!Yt.active&&!Qt){if(n&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))r.right+o||t.clientY>i.bottom&&t.clientX>i.left:t.clientY>r.bottom+o||t.clientX>i.right&&t.clientY>i.top}(t,o,this)&&!m.animated){if(m===F)return M(!1);if(m&&s===t.target&&(a=m),a&&(n=T(a)),!1!==Dt(J,s,F,e,a,n,t,!!a))return U(),m&&m.nextSibling?s.insertBefore(F,m.nextSibling):s.appendChild(F),H=s,j(),M(!0)}else if(m&&function(t,e,n){var i=T(X(n.el,0,n.options,!0)),r=Y(n.el,n.options,K),o=10;return e?t.clientXO+c*o/2:lh-vt)return-yt}else if(l>O+c*(1-r)/2&&lh-c*o/2))return l>O+c/2?1:-1;return 0}(t,a,n,o,b?1:l.swapThreshold,null==l.invertedSwapThreshold?l.swapThreshold:l.invertedSwapThreshold,xt,gt===a),0!==y){var q=C(F);do{q-=y,$=H.children[q]}while($&&("none"===x($,"display")||$===K))}if(0===y||$===a)return M(!1);gt=a,yt=y;var E=a.nextElementSibling,V=!1,Z=Dt(J,s,F,e,a,n,t,V=1===y);if(!1!==Z)return 1!==Z&&-1!==Z||(V=1===Z),_t=!0,setTimeout(Mt,30),U(),V&&!E?s.appendChild(F):a.parentNode.insertBefore(F,V?E:a),_&&A(_,0,k-_.scrollTop),H=F.parentNode,void 0===v||xt||(vt=Math.abs(v-T(a)[P])),j(),M(!0)}if(s.contains(F))return M(!1)}return!1}function W(l,c){G(l,f,r({evt:t,isOwner:h,axis:o?"vertical":"horizontal",revert:i,dragRect:e,targetRect:n,canSort:u,fromSortable:d,target:a,completed:M,onMove:function(n,i){return Dt(J,s,F,e,n,T(n),t,i)},changed:j},c))}function U(){W("dragOverAnimationCapture"),f.captureAnimationState(),f!==d&&d.captureAnimationState()}function M(e){return W("dragOverCompleted",{insertion:e}),e&&(h?O._hideClone():O._showClone(f),f!==d&&(w(F,ct?ct.options.ghostClass:O.options.ghostClass,!1),w(F,l.ghostClass,!0)),ct!==f&&f!==Yt.active?ct=f:f===Yt.active&&ct&&(ct=null),d===f&&(f._ignoreWhileAnimating=a),f.animateAll((function(){W("dragOverAnimationComplete"),f._ignoreWhileAnimating=null})),f!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(a===F&&!F.animated||a===s&&!a.animated)&&(gt=null),l.dragoverBubble||t.rootEl||a===document||(F.parentNode[D]._isOutsideThisEl(t.target),!e&&At(t)),!l.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),p=!0}function j(){ot=C(F),at=C(F,l.draggable),B({sortable:f,name:"change",toEl:s,newIndex:ot,newDraggableIndex:at,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){y(document,"mousemove",this._onTouchMove),y(document,"touchmove",this._onTouchMove),y(document,"pointermove",this._onTouchMove),y(document,"dragover",At),y(document,"mousemove",At),y(document,"touchmove",At)},_offUpEvents:function(){var t=this.el.ownerDocument;y(t,"mouseup",this._onDrop),y(t,"touchend",this._onDrop),y(t,"pointerup",this._onDrop),y(t,"pointercancel",this._onDrop),y(t,"touchcancel",this._onDrop),y(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;ot=C(F),at=C(F,n.draggable),G("drop",this,{evt:t}),H=F&&F.parentNode,ot=C(F),at=C(F,n.draggable),Yt.eventCanceled||(Qt=!1,xt=!1,wt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),It(this.cloneId),It(this._dragStartId),this.nativeDraggable&&(y(document,"drop",this),y(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),d&&x(document.body,"user-select",""),x(F,"transform",""),t&&(mt&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),K&&K.parentNode&&K.parentNode.removeChild(K),(J===H||ct&&"clone"!==ct.lastPutMode)&&nt&&nt.parentNode&&nt.parentNode.removeChild(nt),F&&(this.nativeDraggable&&y(F,"dragend",this),Ut(F),F.style["will-change"]="",mt&&!Qt&&w(F,ct?ct.options.ghostClass:this.options.ghostClass,!1),w(F,this.options.chosenClass,!1),B({sortable:this,name:"unchoose",toEl:H,newIndex:null,newDraggableIndex:null,originalEvent:t}),J!==H?(ot>=0&&(B({rootEl:H,name:"add",toEl:H,fromEl:J,originalEvent:t}),B({sortable:this,name:"remove",toEl:H,originalEvent:t}),B({rootEl:H,name:"sort",toEl:H,fromEl:J,originalEvent:t}),B({sortable:this,name:"sort",toEl:H,originalEvent:t})),ct&&ct.save()):ot!==rt&&ot>=0&&(B({sortable:this,name:"update",toEl:H,originalEvent:t}),B({sortable:this,name:"sort",toEl:H,originalEvent:t})),Yt.active&&(null!=ot&&-1!==ot||(ot=rt,at=st),B({sortable:this,name:"end",toEl:H,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){G("nulling",this),J=F=H=K=tt=nt=et=it=Ot=ht=mt=ot=at=rt=st=gt=yt=ct=lt=Yt.dragged=Yt.ghost=Yt.clone=Yt.active=null,kt.forEach((function(t){t.checked=!0})),kt.length=ut=dt=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":F&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],n=this.el.children,i=0,r=n.length,o=this.options;i{e.read=function(t,e,n,i,r){var o,s,a=8*r-i-1,l=(1<>1,O=-7,h=n?r-1:0,u=n?-1:1,d=t[e+h];for(h+=u,o=d&(1<<-O)-1,d>>=-O,O+=a;O>0;o=256*o+t[e+h],h+=u,O-=8);for(s=o&(1<<-O)-1,o>>=-O,O+=i;O>0;s=256*s+t[e+h],h+=u,O-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=c}return(d?-1:1)*s*Math.pow(2,o-i)},e.write=function(t,e,n,i,r,o){var s,a,l,c=8*o-r-1,O=(1<>1,u=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,f=i?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=O):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+h>=1?u/l:u*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=O?(a=0,s=O):s+h>=1?(a=(e*l-1)*Math.pow(2,r),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;t[n+d]=255&a,d+=f,a/=256,r-=8);for(s=s<0;t[n+d]=255&s,d+=f,s/=256,c-=8);t[n+d-f]|=128*p}},287:(t,e,n)=>{"use strict";var i=n(526),r=n(251),o=n(634);function s(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function f(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(t).length;default:if(i)return D(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return P(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return T(this,e,n);case"base64":return x(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function m(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function g(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:y(t,e,n,i,r);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,i,r){var o,s=1,a=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(r){var O=-1;for(o=n;oa&&(n=a-l),o=n;o>=0;o--){for(var h=!0,u=0;ur&&(i=r):i=r;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s>8,r=n%256,o.push(r),o.push(i);return o}(e,t.length-n),t,n,i)}function x(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function P(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r239?4:c>223?3:c>191?2:1;if(r+h<=n)switch(h){case 1:c<128&&(O=c);break;case 2:128==(192&(o=t[r+1]))&&(l=(31&c)<<6|63&o)>127&&(O=l);break;case 3:o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&(l=(15&c)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(O=l);break;case 4:o=t[r+1],s=t[r+2],a=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(O=l)}null===O?(O=65533,h=1):O>65535&&(O-=65536,i.push(O>>>10&1023|55296),O=56320|1023&O),i.push(O),r+=h}return function(t){var e=t.length;if(e<=_)return String.fromCharCode.apply(String,t);var n="",i=0;for(;i0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},l.prototype.compare=function(t,e,n,i,r){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(r>>>=0)-(i>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(i,r),O=t.slice(e,n),h=0;hr)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return $(this,t,e,n);case"ascii":return Q(this,t,e,n);case"latin1":case"binary":return S(this,t,e,n);case"base64":return b(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function k(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;ri)&&(n=i);for(var r="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,n,i,r,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||et.length)throw new RangeError("Index out of range")}function q(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,o=Math.min(t.length-n,2);r>>8*(i?r:1-r)}function E(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,o=Math.min(t.length-n,4);r>>8*(i?r:3-r)&255}function V(t,e,n,i,r,o){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Z(t,e,n,i,o){return o||V(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function A(t,e,n,i,o){return o||V(t,0,n,8),r.write(t,e,n,i,52,8),n+8}l.prototype.slice=function(t,e){var n,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(r*=256);)i+=this[t+--e]*r;return i},l.prototype.readUInt8=function(t,e){return e||z(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||z(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||z(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||z(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||z(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||z(t,e,this.length);for(var i=this[t],r=1,o=0;++o=(r*=128)&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||z(t,e,this.length);for(var i=e,r=1,o=this[t+--i];i>0&&(r*=256);)o+=this[t+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return e||z(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||z(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){e||z(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return e||z(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||z(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||z(t,4,this.length),r.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||z(t,4,this.length),r.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||z(t,8,this.length),r.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||z(t,8,this.length),r.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||C(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+r]=t/o&255;return e+n},l.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):q(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):q(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):E(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):E(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);C(this,t,e,n,r-1,-r)}var o=0,s=1,a=0;for(this[e]=255&t;++o=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):q(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):q(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):E(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):E(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,n){return Z(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return Z(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return A(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return A(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--r)t[r+e]=this[r+n];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function U(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(W,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function M(t,e,n,i){for(var r=0;r=e.length||r>=t.length);++r)e[r+n]=t[r];return r}},307:(t,e,n)=>{n(196),window.Vue=n(726).default},353:function(t){t.exports=function(){"use strict";var t=1e3,e=6e4,n=36e5,i="millisecond",r="second",o="minute",s="hour",a="day",l="week",c="month",O="quarter",h="year",u="date",d="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},g=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},y={s:g,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),r=n%60;return(e<=0?"+":"-")+g(i,2,"0")+":"+g(r,2,"0")},m:function t(e,n){if(e.date()1)return t(s[0])}else{var a=e.name;$[a]=e,r=a}return!i&&r&&(v=r),r||!i&&v},w=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new P(n)},x=y;x.l=b,x.i=S,x.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var P=function(){function m(t){this.$L=b(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[Q]=!0}var g=m.prototype;return g.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(x.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(f);if(i){var r=i[2]-1||0,o=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,o)):new Date(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,o)}}return new Date(e)}(t),this.init()},g.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},g.$utils=function(){return x},g.isValid=function(){return!(this.$d.toString()===d)},g.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},g.isAfter=function(t,e){return w(t){"use strict";var i=n(606),r=n(287).hp;function o(t,e){return function(){return t.apply(e,arguments)}}const{toString:s}=Object.prototype,{getPrototypeOf:a}=Object,{iterator:l,toStringTag:c}=Symbol,O=(h=Object.create(null),t=>{const e=s.call(t);return h[e]||(h[e]=e.slice(8,-1).toLowerCase())});var h;const u=t=>(t=t.toLowerCase(),e=>O(e)===t),d=t=>e=>typeof e===t,{isArray:f}=Array,p=d("undefined");const m=u("ArrayBuffer");const g=d("string"),y=d("function"),v=d("number"),$=t=>null!==t&&"object"==typeof t,Q=t=>{if("object"!==O(t))return!1;const e=a(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||c in t||l in t)},S=u("Date"),b=u("File"),w=u("Blob"),x=u("FileList"),P=u("URLSearchParams"),[_,k,T,R]=["ReadableStream","Request","Response","Headers"].map(u);function X(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let i,r;if("object"!=typeof t&&(t=[t]),f(t))for(i=0,r=t.length;i0;)if(i=n[r],e===i.toLowerCase())return i;return null}const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,q=t=>!p(t)&&t!==C;const E=(V="undefined"!=typeof Uint8Array&&a(Uint8Array),t=>V&&t instanceof V);var V;const Z=u("HTMLFormElement"),A=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),W=u("RegExp"),Y=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),i={};X(n,((n,r)=>{let o;!1!==(o=e(n,r,t))&&(i[r]=o||n)})),Object.defineProperties(t,i)};const D=u("AsyncFunction"),U=(M="function"==typeof setImmediate,j=y(C.postMessage),M?setImmediate:j?(L=`axios@${Math.random()}`,I=[],C.addEventListener("message",(({source:t,data:e})=>{t===C&&e===L&&I.length&&I.shift()()}),!1),t=>{I.push(t),C.postMessage(L,"*")}):t=>setTimeout(t));var M,j,L,I;const N="undefined"!=typeof queueMicrotask?queueMicrotask.bind(C):void 0!==i&&i.nextTick||U;var G={isArray:f,isArrayBuffer:m,isBuffer:function(t){return null!==t&&!p(t)&&null!==t.constructor&&!p(t.constructor)&&y(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||y(t.append)&&("formdata"===(e=O(t))||"object"===e&&y(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&m(t.buffer),e},isString:g,isNumber:v,isBoolean:t=>!0===t||!1===t,isObject:$,isPlainObject:Q,isReadableStream:_,isRequest:k,isResponse:T,isHeaders:R,isUndefined:p,isDate:S,isFile:b,isBlob:w,isRegExp:W,isFunction:y,isStream:t=>$(t)&&y(t.pipe),isURLSearchParams:P,isTypedArray:E,isFileList:x,forEach:X,merge:function t(){const{caseless:e}=q(this)&&this||{},n={},i=(i,r)=>{const o=e&&z(n,r)||r;Q(n[o])&&Q(i)?n[o]=t(n[o],i):Q(i)?n[o]=t({},i):f(i)?n[o]=i.slice():n[o]=i};for(let t=0,e=arguments.length;t(X(e,((e,i)=>{n&&y(e)?t[i]=o(e,n):t[i]=e}),{allOwnKeys:i}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,i)=>{t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,i)=>{let r,o,s;const l={};if(e=e||{},null==t)return e;do{for(r=Object.getOwnPropertyNames(t),o=r.length;o-- >0;)s=r[o],i&&!i(s,t,e)||l[s]||(e[s]=t[s],l[s]=!0);t=!1!==n&&a(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:O,kindOfTest:u,endsWith:(t,e,n)=>{t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const i=t.indexOf(e,n);return-1!==i&&i===n},toArray:t=>{if(!t)return null;if(f(t))return t;let e=t.length;if(!v(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[l]).call(t);let i;for(;(i=n.next())&&!i.done;){const n=i.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const i=[];for(;null!==(n=t.exec(e));)i.push(n);return i},isHTMLForm:Z,hasOwnProperty:A,hasOwnProp:A,reduceDescriptors:Y,freezeMethods:t=>{Y(t,((e,n)=>{if(y(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const i=t[n];y(i)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(t,e)=>{const n={},i=t=>{t.forEach((t=>{n[t]=!0}))};return f(t)?i(t):i(String(t).split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,n){return e.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:z,global:C,isContextDefined:q,isSpecCompliantForm:function(t){return!!(t&&y(t.append)&&"FormData"===t[c]&&t[l])},toJSONObject:t=>{const e=new Array(10),n=(t,i)=>{if($(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[i]=t;const r=f(t)?[]:{};return X(t,((t,e)=>{const o=n(t,i+1);!p(o)&&(r[e]=o)})),e[i]=void 0,r}}return t};return n(t,0)},isAsyncFn:D,isThenable:t=>t&&($(t)||y(t))&&y(t.then)&&y(t.catch),setImmediate:U,asap:N,isIterable:t=>null!=t&&y(t[l])};function B(t,e,n,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}G.inherits(B,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:G.toJSONObject(this.config),code:this.code,status:this.status}}});const F=B.prototype,H={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{H[t]={value:t}})),Object.defineProperties(B,H),Object.defineProperty(F,"isAxiosError",{value:!0}),B.from=(t,e,n,i,r,o)=>{const s=Object.create(F);return G.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),B.call(s,t.message,e,n,i,r),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};function K(t){return G.isPlainObject(t)||G.isArray(t)}function J(t){return G.endsWith(t,"[]")?t.slice(0,-2):t}function tt(t,e,n){return t?t.concat(e).map((function(t,e){return t=J(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}const et=G.toFlatObject(G,{},null,(function(t){return/^is[A-Z]/.test(t)}));function nt(t,e,n){if(!G.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const i=(n=G.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!G.isUndefined(e[t])}))).metaTokens,o=n.visitor||O,s=n.dots,a=n.indexes,l=(n.Blob||"undefined"!=typeof Blob&&Blob)&&G.isSpecCompliantForm(e);if(!G.isFunction(o))throw new TypeError("visitor must be a function");function c(t){if(null===t)return"";if(G.isDate(t))return t.toISOString();if(!l&&G.isBlob(t))throw new B("Blob is not supported. Use a Buffer instead.");return G.isArrayBuffer(t)||G.isTypedArray(t)?l&&"function"==typeof Blob?new Blob([t]):r.from(t):t}function O(t,n,r){let o=t;if(t&&!r&&"object"==typeof t)if(G.endsWith(n,"{}"))n=i?n:n.slice(0,-2),t=JSON.stringify(t);else if(G.isArray(t)&&function(t){return G.isArray(t)&&!t.some(K)}(t)||(G.isFileList(t)||G.endsWith(n,"[]"))&&(o=G.toArray(t)))return n=J(n),o.forEach((function(t,i){!G.isUndefined(t)&&null!==t&&e.append(!0===a?tt([n],i,s):null===a?n:n+"[]",c(t))})),!1;return!!K(t)||(e.append(tt(r,n,s),c(t)),!1)}const h=[],u=Object.assign(et,{defaultVisitor:O,convertValue:c,isVisitable:K});if(!G.isObject(t))throw new TypeError("data must be an object");return function t(n,i){if(!G.isUndefined(n)){if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+i.join("."));h.push(n),G.forEach(n,(function(n,r){!0===(!(G.isUndefined(n)||null===n)&&o.call(e,n,G.isString(r)?r.trim():r,i,u))&&t(n,i?i.concat(r):[r])})),h.pop()}}(t),e}function it(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function rt(t,e){this._pairs=[],t&&nt(t,this,e)}const ot=rt.prototype;function st(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function at(t,e,n){if(!e)return t;const i=n&&n.encode||st;G.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let o;if(o=r?r(e,n):G.isURLSearchParams(e)?e.toString():new rt(e,n).toString(i),o){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+o}return t}ot.append=function(t,e){this._pairs.push([t,e])},ot.toString=function(t){const e=t?function(e){return t.call(this,e,it)}:it;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};var lt=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){G.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},ct={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ot={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:rt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ht="undefined"!=typeof window&&"undefined"!=typeof document,ut="object"==typeof navigator&&navigator||void 0,dt=ht&&(!ut||["ReactNative","NativeScript","NS"].indexOf(ut.product)<0),ft="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,pt=ht&&window.location.href||"http://localhost";var mt={...Object.freeze({__proto__:null,hasBrowserEnv:ht,hasStandardBrowserWebWorkerEnv:ft,hasStandardBrowserEnv:dt,navigator:ut,origin:pt}),...Ot};function gt(t){function e(t,n,i,r){let o=t[r++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=r>=t.length;if(o=!o&&G.isArray(i)?i.length:o,a)return G.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!s;i[o]&&G.isObject(i[o])||(i[o]=[]);return e(t,n,i[o],r)&&G.isArray(i[o])&&(i[o]=function(t){const e={},n=Object.keys(t);let i;const r=n.length;let o;for(i=0;i{e(function(t){return G.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),i,n,0)})),n}return null}const yt={transitional:ct,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",i=n.indexOf("application/json")>-1,r=G.isObject(t);r&&G.isHTMLForm(t)&&(t=new FormData(t));if(G.isFormData(t))return i?JSON.stringify(gt(t)):t;if(G.isArrayBuffer(t)||G.isBuffer(t)||G.isStream(t)||G.isFile(t)||G.isBlob(t)||G.isReadableStream(t))return t;if(G.isArrayBufferView(t))return t.buffer;if(G.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(r){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return nt(t,new mt.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,i){return mt.isNode&&G.isBuffer(t)?(this.append(e,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((o=G.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return nt(o?{"files[]":t}:t,e&&new e,this.formSerializer)}}return r||i?(e.setContentType("application/json",!1),function(t,e,n){if(G.isString(t))try{return(e||JSON.parse)(t),G.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||yt.transitional,n=e&&e.forcedJSONParsing,i="json"===this.responseType;if(G.isResponse(t)||G.isReadableStream(t))return t;if(t&&G.isString(t)&&(n&&!this.responseType||i)){const n=!(e&&e.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw B.from(t,B.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:mt.classes.FormData,Blob:mt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};G.forEach(["delete","get","head","post","put","patch"],(t=>{yt.headers[t]={}}));var vt=yt;const $t=G.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Qt=Symbol("internals");function St(t){return t&&String(t).trim().toLowerCase()}function bt(t){return!1===t||null==t?t:G.isArray(t)?t.map(bt):String(t)}function wt(t,e,n,i,r){return G.isFunction(i)?i.call(this,e,n):(r&&(e=n),G.isString(e)?G.isString(i)?-1!==e.indexOf(i):G.isRegExp(i)?i.test(e):void 0:void 0)}class xt{constructor(t){t&&this.set(t)}set(t,e,n){const i=this;function r(t,e,n){const r=St(e);if(!r)throw new Error("header name must be a non-empty string");const o=G.findKey(i,r);(!o||void 0===i[o]||!0===n||void 0===n&&!1!==i[o])&&(i[o||e]=bt(t))}const o=(t,e)=>G.forEach(t,((t,n)=>r(t,n,e)));if(G.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(G.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))o((t=>{const e={};let n,i,r;return t&&t.split("\n").forEach((function(t){r=t.indexOf(":"),n=t.substring(0,r).trim().toLowerCase(),i=t.substring(r+1).trim(),!n||e[n]&&$t[n]||("set-cookie"===n?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)})),e})(t),e);else if(G.isObject(t)&&G.isIterable(t)){let n,i,r={};for(const e of t){if(!G.isArray(e))throw TypeError("Object iterator must return a key-value pair");r[i=e[0]]=(n=r[i])?G.isArray(n)?[...n,e[1]]:[n,e[1]]:e[1]}o(r,e)}else null!=t&&r(e,t,n);return this}get(t,e){if(t=St(t)){const n=G.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}(t);if(G.isFunction(e))return e.call(this,t,n);if(G.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=St(t)){const n=G.findKey(this,t);return!(!n||void 0===this[n]||e&&!wt(0,this[n],n,e))}return!1}delete(t,e){const n=this;let i=!1;function r(t){if(t=St(t)){const r=G.findKey(n,t);!r||e&&!wt(0,n[r],r,e)||(delete n[r],i=!0)}}return G.isArray(t)?t.forEach(r):r(t),i}clear(t){const e=Object.keys(this);let n=e.length,i=!1;for(;n--;){const r=e[n];t&&!wt(0,this[r],r,t,!0)||(delete this[r],i=!0)}return i}normalize(t){const e=this,n={};return G.forEach(this,((i,r)=>{const o=G.findKey(n,r);if(o)return e[o]=bt(i),void delete e[r];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}(r):String(r).trim();s!==r&&delete e[r],e[s]=bt(i),n[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return G.forEach(this,((n,i)=>{null!=n&&!1!==n&&(e[i]=t&&G.isArray(n)?n.join(", "):n)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach((t=>n.set(t))),n}static accessor(t){const e=(this[Qt]=this[Qt]={accessors:{}}).accessors,n=this.prototype;function i(t){const i=St(t);e[i]||(!function(t,e){const n=G.toCamelCase(" "+e);["get","set","has"].forEach((i=>{Object.defineProperty(t,i+n,{value:function(t,n,r){return this[i].call(this,e,t,n,r)},configurable:!0})}))}(n,t),e[i]=!0)}return G.isArray(t)?t.forEach(i):i(t),this}}xt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),G.reduceDescriptors(xt.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),G.freezeMethods(xt);var Pt=xt;function _t(t,e){const n=this||vt,i=e||n,r=Pt.from(i.headers);let o=i.data;return G.forEach(t,(function(t){o=t.call(n,o,r.normalize(),e?e.status:void 0)})),r.normalize(),o}function kt(t){return!(!t||!t.__CANCEL__)}function Tt(t,e,n){B.call(this,null==t?"canceled":t,B.ERR_CANCELED,e,n),this.name="CanceledError"}function Rt(t,e,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(new B("Request failed with status code "+n.status,[B.ERR_BAD_REQUEST,B.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}G.inherits(Tt,B,{__CANCEL__:!0});const Xt=(t,e,n=3)=>{let i=0;const r=function(t,e){t=t||10;const n=new Array(t),i=new Array(t);let r,o=0,s=0;return e=void 0!==e?e:1e3,function(a){const l=Date.now(),c=i[s];r||(r=l),n[o]=a,i[o]=l;let O=s,h=0;for(;O!==o;)h+=n[O++],O%=t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),l-r{r=o,n=null,i&&(clearTimeout(i),i=null),t.apply(null,e)};return[(...t)=>{const e=Date.now(),a=e-r;a>=o?s(t,e):(n=t,i||(i=setTimeout((()=>{i=null,s(n)}),o-a)))},()=>n&&s(n)]}((n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-i,l=r(a);i=o;t({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&o<=s?(s-o)/l:void 0,event:n,lengthComputable:null!=s,[e?"download":"upload"]:!0})}),n)},zt=(t,e)=>{const n=null!=t;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},Ct=t=>(...e)=>G.asap((()=>t(...e)));var qt=mt.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,mt.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(mt.origin),mt.navigator&&/(msie|trident)/i.test(mt.navigator.userAgent)):()=>!0,Et=mt.hasStandardBrowserEnv?{write(t,e,n,i,r,o){const s=[t+"="+encodeURIComponent(e)];G.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),G.isString(i)&&s.push("path="+i),G.isString(r)&&s.push("domain="+r),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Vt(t,e,n){let i=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(i||0==n)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Zt=t=>t instanceof Pt?{...t}:t;function At(t,e){e=e||{};const n={};function i(t,e,n,i){return G.isPlainObject(t)&&G.isPlainObject(e)?G.merge.call({caseless:i},t,e):G.isPlainObject(e)?G.merge({},e):G.isArray(e)?e.slice():e}function r(t,e,n,r){return G.isUndefined(e)?G.isUndefined(t)?void 0:i(void 0,t,0,r):i(t,e,0,r)}function o(t,e){if(!G.isUndefined(e))return i(void 0,e)}function s(t,e){return G.isUndefined(e)?G.isUndefined(t)?void 0:i(void 0,t):i(void 0,e)}function a(n,r,o){return o in e?i(n,r):o in t?i(void 0,n):void 0}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(t,e,n)=>r(Zt(t),Zt(e),0,!0)};return G.forEach(Object.keys(Object.assign({},t,e)),(function(i){const o=l[i]||r,s=o(t[i],e[i],i);G.isUndefined(s)&&o!==a||(n[i]=s)})),n}var Wt=t=>{const e=At({},t);let n,{data:i,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:l}=e;if(e.headers=a=Pt.from(a),e.url=at(Vt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),G.isFormData(i))if(mt.hasStandardBrowserEnv||mt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[t,...e]=n?n.split(";").map((t=>t.trim())).filter(Boolean):[];a.setContentType([t||"multipart/form-data",...e].join("; "))}if(mt.hasStandardBrowserEnv&&(r&&G.isFunction(r)&&(r=r(e)),r||!1!==r&&qt(e.url))){const t=o&&s&&Et.read(s);t&&a.set(o,t)}return e};var Yt="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){const i=Wt(t);let r=i.data;const o=Pt.from(i.headers).normalize();let s,a,l,c,O,{responseType:h,onUploadProgress:u,onDownloadProgress:d}=i;function f(){c&&c(),O&&O(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let p=new XMLHttpRequest;function m(){if(!p)return;const i=Pt.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders());Rt((function(t){e(t),f()}),(function(t){n(t),f()}),{data:h&&"text"!==h&&"json"!==h?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:i,config:t,request:p}),p=null}p.open(i.method.toUpperCase(),i.url,!0),p.timeout=i.timeout,"onloadend"in p?p.onloadend=m:p.onreadystatechange=function(){p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))&&setTimeout(m)},p.onabort=function(){p&&(n(new B("Request aborted",B.ECONNABORTED,t,p)),p=null)},p.onerror=function(){n(new B("Network Error",B.ERR_NETWORK,t,p)),p=null},p.ontimeout=function(){let e=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const r=i.transitional||ct;i.timeoutErrorMessage&&(e=i.timeoutErrorMessage),n(new B(e,r.clarifyTimeoutError?B.ETIMEDOUT:B.ECONNABORTED,t,p)),p=null},void 0===r&&o.setContentType(null),"setRequestHeader"in p&&G.forEach(o.toJSON(),(function(t,e){p.setRequestHeader(e,t)})),G.isUndefined(i.withCredentials)||(p.withCredentials=!!i.withCredentials),h&&"json"!==h&&(p.responseType=i.responseType),d&&([l,O]=Xt(d,!0),p.addEventListener("progress",l)),u&&p.upload&&([a,c]=Xt(u),p.upload.addEventListener("progress",a),p.upload.addEventListener("loadend",c)),(i.cancelToken||i.signal)&&(s=e=>{p&&(n(!e||e.type?new Tt(null,t,p):e),p.abort(),p=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));const g=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(i.url);g&&-1===mt.protocols.indexOf(g)?n(new B("Unsupported protocol "+g+":",B.ERR_BAD_REQUEST,t)):p.send(r||null)}))};var Dt=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let n,i=new AbortController;const r=function(t){if(!n){n=!0,s();const e=t instanceof Error?t:this.reason;i.abort(e instanceof B?e:new Tt(e instanceof Error?e.message:e))}};let o=e&&setTimeout((()=>{o=null,r(new B(`timeout ${e} of ms exceeded`,B.ETIMEDOUT))}),e);const s=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach((t=>{t.unsubscribe?t.unsubscribe(r):t.removeEventListener("abort",r)})),t=null)};t.forEach((t=>t.addEventListener("abort",r)));const{signal:a}=i;return a.unsubscribe=()=>G.asap(s),a}};const Ut=function*(t,e){let n=t.byteLength;if(!e||n{const r=async function*(t,e){for await(const n of Mt(t))yield*Ut(n,e)}(t,e);let o,s=0,a=t=>{o||(o=!0,i&&i(t))};return new ReadableStream({async pull(t){try{const{done:e,value:i}=await r.next();if(e)return a(),void t.close();let o=i.byteLength;if(n){let t=s+=o;n(t)}t.enqueue(new Uint8Array(i))}catch(t){throw a(t),t}},cancel:t=>(a(t),r.return())},{highWaterMark:2})},Lt="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,It=Lt&&"function"==typeof ReadableStream,Nt=Lt&&("function"==typeof TextEncoder?(Gt=new TextEncoder,t=>Gt.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var Gt;const Bt=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},Ft=It&&Bt((()=>{let t=!1;const e=new Request(mt.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})),Ht=It&&Bt((()=>G.isReadableStream(new Response("").body))),Kt={stream:Ht&&(t=>t.body)};var Jt;Lt&&(Jt=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!Kt[t]&&(Kt[t]=G.isFunction(Jt[t])?e=>e[t]():(e,n)=>{throw new B(`Response type '${t}' is not supported`,B.ERR_NOT_SUPPORT,n)})})));const te=async(t,e)=>{const n=G.toFiniteNumber(t.getContentLength());return null==n?(async t=>{if(null==t)return 0;if(G.isBlob(t))return t.size;if(G.isSpecCompliantForm(t)){const e=new Request(mt.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return G.isArrayBufferView(t)||G.isArrayBuffer(t)?t.byteLength:(G.isURLSearchParams(t)&&(t+=""),G.isString(t)?(await Nt(t)).byteLength:void 0)})(e):n};const ee={http:null,xhr:Yt,fetch:Lt&&(async t=>{let{url:e,method:n,data:i,signal:r,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:O,withCredentials:h="same-origin",fetchOptions:u}=Wt(t);c=c?(c+"").toLowerCase():"text";let d,f=Dt([r,o&&o.toAbortSignal()],s);const p=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let m;try{if(l&&Ft&&"get"!==n&&"head"!==n&&0!==(m=await te(O,i))){let t,n=new Request(e,{method:"POST",body:i,duplex:"half"});if(G.isFormData(i)&&(t=n.headers.get("content-type"))&&O.setContentType(t),n.body){const[t,e]=zt(m,Xt(Ct(l)));i=jt(n.body,65536,t,e)}}G.isString(h)||(h=h?"include":"omit");const r="credentials"in Request.prototype;d=new Request(e,{...u,signal:f,method:n.toUpperCase(),headers:O.normalize().toJSON(),body:i,duplex:"half",credentials:r?h:void 0});let o=await fetch(d);const s=Ht&&("stream"===c||"response"===c);if(Ht&&(a||s&&p)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=o[e]}));const e=G.toFiniteNumber(o.headers.get("content-length")),[n,i]=a&&zt(e,Xt(Ct(a),!0))||[];o=new Response(jt(o.body,65536,n,(()=>{i&&i(),p&&p()})),t)}c=c||"text";let g=await Kt[G.findKey(Kt,c)||"text"](o,t);return!s&&p&&p(),await new Promise(((e,n)=>{Rt(e,n,{data:g,headers:Pt.from(o.headers),status:o.status,statusText:o.statusText,config:t,request:d})}))}catch(e){if(p&&p(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new B("Network Error",B.ERR_NETWORK,t,d),{cause:e.cause||e});throw B.from(e,e&&e.code,t,d)}})};G.forEach(ee,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const ne=t=>`- ${t}`,ie=t=>G.isFunction(t)||null===t||!1===t;var re=t=>{t=G.isArray(t)?t:[t];const{length:e}=t;let n,i;const r={};for(let o=0;o`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));throw new B("There is no suitable adapter to dispatch the request "+(e?t.length>1?"since :\n"+t.map(ne).join("\n"):" "+ne(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i};function oe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Tt(null,t)}function se(t){oe(t),t.headers=Pt.from(t.headers),t.data=_t.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return re(t.adapter||vt.adapter)(t).then((function(e){return oe(t),e.data=_t.call(t,t.transformResponse,e),e.headers=Pt.from(e.headers),e}),(function(e){return kt(e)||(oe(t),e&&e.response&&(e.response.data=_t.call(t,t.transformResponse,e.response),e.response.headers=Pt.from(e.response.headers))),Promise.reject(e)}))}const ae="1.9.0",le={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{le[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));const ce={};le.transitional=function(t,e,n){function i(t,e){return"[Axios v1.9.0] Transitional option '"+t+"'"+e+(n?". "+n:"")}return(n,r,o)=>{if(!1===t)throw new B(i(r," has been removed"+(e?" in "+e:"")),B.ERR_DEPRECATED);return e&&!ce[r]&&(ce[r]=!0,console.warn(i(r," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,r,o)}},le.spelling=function(t){return(e,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};var Oe={assertOptions:function(t,e,n){if("object"!=typeof t)throw new B("options must be an object",B.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let r=i.length;for(;r-- >0;){const o=i[r],s=e[o];if(s){const e=t[o],n=void 0===e||s(e,o,t);if(!0!==n)throw new B("option "+o+" must be "+n,B.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new B("Unknown option "+o,B.ERR_BAD_OPTION)}},validators:le};const he=Oe.validators;class ue{constructor(t){this.defaults=t||{},this.interceptors={request:new lt,response:new lt}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const n=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?n&&!String(t.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+n):t.stack=n}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=At(this.defaults,e);const{transitional:n,paramsSerializer:i,headers:r}=e;void 0!==n&&Oe.assertOptions(n,{silentJSONParsing:he.transitional(he.boolean),forcedJSONParsing:he.transitional(he.boolean),clarifyTimeoutError:he.transitional(he.boolean)},!1),null!=i&&(G.isFunction(i)?e.paramsSerializer={serialize:i}:Oe.assertOptions(i,{encode:he.function,serialize:he.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Oe.assertOptions(e,{baseUrl:he.spelling("baseURL"),withXsrfToken:he.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=r&&G.merge(r.common,r[e.method]);r&&G.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete r[t]})),e.headers=Pt.concat(o,r);const s=[];let a=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));const l=[];let c;this.interceptors.response.forEach((function(t){l.push(t.fulfilled,t.rejected)}));let O,h=0;if(!a){const t=[se.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,l),O=t.length,c=Promise.resolve(e);h{if(!n._listeners)return;let e=n._listeners.length;for(;e-- >0;)n._listeners[e](t);n._listeners=null})),this.promise.then=t=>{let e;const i=new Promise((t=>{n.subscribe(t),e=t})).then(t);return i.cancel=function(){n.unsubscribe(e)},i},t((function(t,i,r){n.reason||(n.reason=new Tt(t,i,r),e(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new fe((function(e){t=e})),cancel:t}}}var pe=fe;const me={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(me).forEach((([t,e])=>{me[e]=t}));var ge=me;const ye=function t(e){const n=new de(e),i=o(de.prototype.request,n);return G.extend(i,de.prototype,n,{allOwnKeys:!0}),G.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return t(At(e,n))},i}(vt);ye.Axios=de,ye.CanceledError=Tt,ye.CancelToken=pe,ye.isCancel=kt,ye.VERSION=ae,ye.toFormData=nt,ye.AxiosError=B,ye.Cancel=ye.CanceledError,ye.all=function(t){return Promise.all(t)},ye.spread=function(t){return function(e){return t.apply(null,e)}},ye.isAxiosError=function(t){return G.isObject(t)&&!0===t.isAxiosError},ye.mergeConfig=At,ye.AxiosHeaders=Pt,ye.formToJSON=t=>gt(G.isHTMLForm(t)?new FormData(t):t),ye.getAdapter=re,ye.HttpStatusCode=ge,ye.default=ye,t.exports=ye},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],i=e[1];return 3*(n+i)/4-i},e.toByteArray=function(t){var e,n,o=a(t),s=o[0],l=o[1],c=new r(function(t,e,n){return 3*(e+n)/4-n}(0,s,l)),O=0,h=l>0?s-4:s;for(n=0;n>16&255,c[O++]=e>>8&255,c[O++]=255&e;2===l&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,c[O++]=255&e);1===l&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,c[O++]=e>>8&255,c[O++]=255&e);return c},e.fromByteArray=function(t){for(var e,i=t.length,r=i%3,o=[],s=16383,a=0,c=i-r;ac?c:a+s));1===r?(e=t[i-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===r&&(e=(t[i-2]<<8)+t[i-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],i[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t,e,i){for(var r,o,s=[],a=e;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},543:function(t,e,n){var i;t=n.nmd(t),function(){var r,o="Expected a function",s="__lodash_hash_undefined__",a="__lodash_placeholder__",l=16,c=32,O=64,h=128,u=256,d=1/0,f=9007199254740991,p=NaN,m=4294967295,g=[["ary",h],["bind",1],["bindKey",2],["curry",8],["curryRight",l],["flip",512],["partial",c],["partialRight",O],["rearg",u]],y="[object Arguments]",v="[object Array]",$="[object Boolean]",Q="[object Date]",S="[object Error]",b="[object Function]",w="[object GeneratorFunction]",x="[object Map]",P="[object Number]",_="[object Object]",k="[object Promise]",T="[object RegExp]",R="[object Set]",X="[object String]",z="[object Symbol]",C="[object WeakMap]",q="[object ArrayBuffer]",E="[object DataView]",V="[object Float32Array]",Z="[object Float64Array]",A="[object Int8Array]",W="[object Int16Array]",Y="[object Int32Array]",D="[object Uint8Array]",U="[object Uint8ClampedArray]",M="[object Uint16Array]",j="[object Uint32Array]",L=/\b__p \+= '';/g,I=/\b(__p \+=) '' \+/g,N=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,B=/[&<>"']/g,F=RegExp(G.source),H=RegExp(B.source),K=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,tt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nt=/^\w*$/,it=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rt=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(rt.source),st=/^\s+/,at=/\s/,lt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ct=/\{\n\/\* \[wrapped with (.+)\] \*/,Ot=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ut=/[()=,{}\[\]\/\s]/,dt=/\\(\\)?/g,ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pt=/\w*$/,mt=/^[-+]0x[0-9a-f]+$/i,gt=/^0b[01]+$/i,yt=/^\[object .+?Constructor\]$/,vt=/^0o[0-7]+$/i,$t=/^(?:0|[1-9]\d*)$/,Qt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,St=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",xt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pt="\\u2700-\\u27bf",_t="a-z\\xdf-\\xf6\\xf8-\\xff",kt="A-Z\\xc0-\\xd6\\xd8-\\xde",Tt="\\ufe0e\\ufe0f",Rt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Xt="['’]",zt="["+wt+"]",Ct="["+Rt+"]",qt="["+xt+"]",Et="\\d+",Vt="["+Pt+"]",Zt="["+_t+"]",At="[^"+wt+Rt+Et+Pt+_t+kt+"]",Wt="\\ud83c[\\udffb-\\udfff]",Yt="[^"+wt+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ut="[\\ud800-\\udbff][\\udc00-\\udfff]",Mt="["+kt+"]",jt="\\u200d",Lt="(?:"+Zt+"|"+At+")",It="(?:"+Mt+"|"+At+")",Nt="(?:['’](?:d|ll|m|re|s|t|ve))?",Gt="(?:['’](?:D|LL|M|RE|S|T|VE))?",Bt="(?:"+qt+"|"+Wt+")"+"?",Ft="["+Tt+"]?",Ht=Ft+Bt+("(?:"+jt+"(?:"+[Yt,Dt,Ut].join("|")+")"+Ft+Bt+")*"),Kt="(?:"+[Vt,Dt,Ut].join("|")+")"+Ht,Jt="(?:"+[Yt+qt+"?",qt,Dt,Ut,zt].join("|")+")",te=RegExp(Xt,"g"),ee=RegExp(qt,"g"),ne=RegExp(Wt+"(?="+Wt+")|"+Jt+Ht,"g"),ie=RegExp([Mt+"?"+Zt+"+"+Nt+"(?="+[Ct,Mt,"$"].join("|")+")",It+"+"+Gt+"(?="+[Ct,Mt+Lt,"$"].join("|")+")",Mt+"?"+Lt+"+"+Nt,Mt+"+"+Gt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Et,Kt].join("|"),"g"),re=RegExp("["+jt+wt+xt+Tt+"]"),oe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,le={};le[V]=le[Z]=le[A]=le[W]=le[Y]=le[D]=le[U]=le[M]=le[j]=!0,le[y]=le[v]=le[q]=le[$]=le[E]=le[Q]=le[S]=le[b]=le[x]=le[P]=le[_]=le[T]=le[R]=le[X]=le[C]=!1;var ce={};ce[y]=ce[v]=ce[q]=ce[E]=ce[$]=ce[Q]=ce[V]=ce[Z]=ce[A]=ce[W]=ce[Y]=ce[x]=ce[P]=ce[_]=ce[T]=ce[R]=ce[X]=ce[z]=ce[D]=ce[U]=ce[M]=ce[j]=!0,ce[S]=ce[b]=ce[C]=!1;var Oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},he=parseFloat,ue=parseInt,de="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,fe="object"==typeof self&&self&&self.Object===Object&&self,pe=de||fe||Function("return this")(),me=e&&!e.nodeType&&e,ge=me&&t&&!t.nodeType&&t,ye=ge&&ge.exports===me,ve=ye&&de.process,$e=function(){try{var t=ge&&ge.require&&ge.require("util").types;return t||ve&&ve.binding&&ve.binding("util")}catch(t){}}(),Qe=$e&&$e.isArrayBuffer,Se=$e&&$e.isDate,be=$e&&$e.isMap,we=$e&&$e.isRegExp,xe=$e&&$e.isSet,Pe=$e&&$e.isTypedArray;function _e(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function ke(t,e,n,i){for(var r=-1,o=null==t?0:t.length;++r-1}function qe(t,e,n){for(var i=-1,r=null==t?0:t.length;++i-1;);return n}function rn(t,e){for(var n=t.length;n--&&Me(e,t[n],0)>-1;);return n}var on=Ge({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),sn=Ge({"&":"&","<":"<",">":">",'"':""","'":"'"});function an(t){return"\\"+Oe[t]}function ln(t){return re.test(t)}function cn(t){var e=-1,n=Array(t.size);return t.forEach((function(t,i){n[++e]=[i,t]})),n}function On(t,e){return function(n){return t(e(n))}}function hn(t,e){for(var n=-1,i=t.length,r=0,o=[];++n",""":'"',"'":"'"});var yn=function t(e){var n,i=(e=null==e?pe:yn.defaults(pe.Object(),e,yn.pick(pe,se))).Array,at=e.Date,wt=e.Error,xt=e.Function,Pt=e.Math,_t=e.Object,kt=e.RegExp,Tt=e.String,Rt=e.TypeError,Xt=i.prototype,zt=xt.prototype,Ct=_t.prototype,qt=e["__core-js_shared__"],Et=zt.toString,Vt=Ct.hasOwnProperty,Zt=0,At=(n=/[^.]+$/.exec(qt&&qt.keys&&qt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Wt=Ct.toString,Yt=Et.call(_t),Dt=pe._,Ut=kt("^"+Et.call(Vt).replace(rt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mt=ye?e.Buffer:r,jt=e.Symbol,Lt=e.Uint8Array,It=Mt?Mt.allocUnsafe:r,Nt=On(_t.getPrototypeOf,_t),Gt=_t.create,Bt=Ct.propertyIsEnumerable,Ft=Xt.splice,Ht=jt?jt.isConcatSpreadable:r,Kt=jt?jt.iterator:r,Jt=jt?jt.toStringTag:r,ne=function(){try{var t=uo(_t,"defineProperty");return t({},"",{}),t}catch(t){}}(),re=e.clearTimeout!==pe.clearTimeout&&e.clearTimeout,Oe=at&&at.now!==pe.Date.now&&at.now,de=e.setTimeout!==pe.setTimeout&&e.setTimeout,fe=Pt.ceil,me=Pt.floor,ge=_t.getOwnPropertySymbols,ve=Mt?Mt.isBuffer:r,$e=e.isFinite,Ye=Xt.join,Ge=On(_t.keys,_t),vn=Pt.max,$n=Pt.min,Qn=at.now,Sn=e.parseInt,bn=Pt.random,wn=Xt.reverse,xn=uo(e,"DataView"),Pn=uo(e,"Map"),_n=uo(e,"Promise"),kn=uo(e,"Set"),Tn=uo(e,"WeakMap"),Rn=uo(_t,"create"),Xn=Tn&&new Tn,zn={},Cn=Wo(xn),qn=Wo(Pn),En=Wo(_n),Vn=Wo(kn),Zn=Wo(Tn),An=jt?jt.prototype:r,Wn=An?An.valueOf:r,Yn=An?An.toString:r;function Dn(t){if(na(t)&&!Ls(t)&&!(t instanceof Ln)){if(t instanceof jn)return t;if(Vt.call(t,"__wrapped__"))return Yo(t)}return new jn(t)}var Un=function(){function t(){}return function(e){if(!ea(e))return{};if(Gt)return Gt(e);t.prototype=e;var n=new t;return t.prototype=r,n}}();function Mn(){}function jn(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=r}function Ln(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function In(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function ci(t,e,n,i,o,s){var a,l=1&e,c=2&e,O=4&e;if(n&&(a=o?n(t,i,o,s):n(t)),a!==r)return a;if(!ea(t))return t;var h=Ls(t);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);e&&"string"==typeof t[0]&&Vt.call(t,"index")&&(n.index=t.index,n.input=t.input);return n}(t),!l)return Rr(t,a)}else{var u=mo(t),d=u==b||u==w;if(Bs(t))return wr(t,l);if(u==_||u==y||d&&!o){if(a=c||d?{}:yo(t),!l)return c?function(t,e){return Xr(t,po(t),e)}(t,function(t,e){return t&&Xr(e,Ca(e),t)}(a,t)):function(t,e){return Xr(t,fo(t),e)}(t,oi(a,t))}else{if(!ce[u])return o?t:{};a=function(t,e,n){var i=t.constructor;switch(e){case q:return xr(t);case $:case Q:return new i(+t);case E:return function(t,e){var n=e?xr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case V:case Z:case A:case W:case Y:case D:case U:case M:case j:return Pr(t,n);case x:return new i;case P:case X:return new i(t);case T:return function(t){var e=new t.constructor(t.source,pt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case R:return new i;case z:return r=t,Wn?_t(Wn.call(r)):{}}var r}(t,u,l)}}s||(s=new Fn);var f=s.get(t);if(f)return f;s.set(t,a),aa(t)?t.forEach((function(i){a.add(ci(i,e,n,i,t,s))})):ia(t)&&t.forEach((function(i,r){a.set(r,ci(i,e,n,r,t,s))}));var p=h?r:(O?c?oo:ro:c?Ca:za)(t);return Te(p||t,(function(i,r){p&&(i=t[r=i]),ni(a,r,ci(i,e,n,r,t,s))})),a}function Oi(t,e,n){var i=n.length;if(null==t)return!i;for(t=_t(t);i--;){var o=n[i],s=e[o],a=t[o];if(a===r&&!(o in t)||!s(a))return!1}return!0}function hi(t,e,n){if("function"!=typeof t)throw new Rt(o);return zo((function(){t.apply(r,n)}),e)}function ui(t,e,n,i){var r=-1,o=Ce,s=!0,a=t.length,l=[],c=e.length;if(!a)return l;n&&(e=Ee(e,Je(n))),i?(o=qe,s=!1):e.length>=200&&(o=en,s=!1,e=new Bn(e));t:for(;++r-1},Nn.prototype.set=function(t,e){var n=this.__data__,i=ii(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this},Gn.prototype.clear=function(){this.size=0,this.__data__={hash:new In,map:new(Pn||Nn),string:new In}},Gn.prototype.delete=function(t){var e=Oo(this,t).delete(t);return this.size-=e?1:0,e},Gn.prototype.get=function(t){return Oo(this,t).get(t)},Gn.prototype.has=function(t){return Oo(this,t).has(t)},Gn.prototype.set=function(t,e){var n=Oo(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this},Bn.prototype.add=Bn.prototype.push=function(t){return this.__data__.set(t,s),this},Bn.prototype.has=function(t){return this.__data__.has(t)},Fn.prototype.clear=function(){this.__data__=new Nn,this.size=0},Fn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Fn.prototype.get=function(t){return this.__data__.get(t)},Fn.prototype.has=function(t){return this.__data__.has(t)},Fn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Nn){var i=n.__data__;if(!Pn||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new Gn(i)}return n.set(t,e),this.size=n.size,this};var di=qr(Qi),fi=qr(Si,!0);function pi(t,e){var n=!0;return di(t,(function(t,i,r){return n=!!e(t,i,r)})),n}function mi(t,e,n){for(var i=-1,o=t.length;++i0&&n(a)?e>1?yi(a,e-1,n,i,r):Ve(r,a):i||(r[r.length]=a)}return r}var vi=Er(),$i=Er(!0);function Qi(t,e){return t&&vi(t,e,za)}function Si(t,e){return t&&$i(t,e,za)}function bi(t,e){return ze(e,(function(e){return Ks(t[e])}))}function wi(t,e){for(var n=0,i=(e=$r(e,t)).length;null!=t&&ne}function ki(t,e){return null!=t&&Vt.call(t,e)}function Ti(t,e){return null!=t&&e in _t(t)}function Ri(t,e,n){for(var o=n?qe:Ce,s=t[0].length,a=t.length,l=a,c=i(a),O=1/0,h=[];l--;){var u=t[l];l&&e&&(u=Ee(u,Je(e))),O=$n(u.length,O),c[l]=!n&&(e||s>=120&&u.length>=120)?new Bn(l&&u):r}u=t[0];var d=-1,f=c[0];t:for(;++d=a?l:l*("desc"==n[i]?-1:1)}return t.index-e.index}(t,e,n)}))}function Ii(t,e,n){for(var i=-1,r=e.length,o={};++i-1;)a!==t&&Ft.call(a,l,1),Ft.call(t,l,1);return t}function Gi(t,e){for(var n=t?e.length:0,i=n-1;n--;){var r=e[n];if(n==i||r!==o){var o=r;$o(r)?Ft.call(t,r,1):ur(t,r)}}return t}function Bi(t,e){return t+me(bn()*(e-t+1))}function Fi(t,e){var n="";if(!t||e<1||e>f)return n;do{e%2&&(n+=t),(e=me(e/2))&&(t+=t)}while(e);return n}function Hi(t,e){return Co(ko(t,e,rl),t+"")}function Ki(t){return Kn(Da(t))}function Ji(t,e){var n=Da(t);return Vo(n,li(e,0,n.length))}function tr(t,e,n,i){if(!ea(t))return t;for(var o=-1,s=(e=$r(e,t)).length,a=s-1,l=t;null!=l&&++oo?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var s=i(o);++r>>1,s=t[o];null!==s&&!ca(s)&&(n?s<=e:s=200){var c=e?null:Fr(t);if(c)return un(c);s=!1,r=en,l=new Bn}else l=e?[]:a;t:for(;++i=i?t:rr(t,e,n)}var br=re||function(t){return pe.clearTimeout(t)};function wr(t,e){if(e)return t.slice();var n=t.length,i=It?It(n):new t.constructor(n);return t.copy(i),i}function xr(t){var e=new t.constructor(t.byteLength);return new Lt(e).set(new Lt(t)),e}function Pr(t,e){var n=e?xr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function _r(t,e){if(t!==e){var n=t!==r,i=null===t,o=t==t,s=ca(t),a=e!==r,l=null===e,c=e==e,O=ca(e);if(!l&&!O&&!s&&t>e||s&&a&&c&&!l&&!O||i&&a&&c||!n&&c||!o)return 1;if(!i&&!s&&!O&&t1?n[o-1]:r,a=o>2?n[2]:r;for(s=t.length>3&&"function"==typeof s?(o--,s):r,a&&Qo(n[0],n[1],a)&&(s=o<3?r:s,o=1),e=_t(e);++i-1?o[s?e[a]:a]:r}}function Yr(t){return io((function(e){var n=e.length,i=n,s=jn.prototype.thru;for(t&&e.reverse();i--;){var a=e[i];if("function"!=typeof a)throw new Rt(o);if(s&&!l&&"wrapper"==ao(a))var l=new jn([],!0)}for(i=l?i:n;++i1&&$.reverse(),d&&Ol))return!1;var O=s.get(t),h=s.get(e);if(O&&h)return O==e&&h==t;var u=-1,d=!0,f=2&n?new Bn:r;for(s.set(t,e),s.set(e,t);++u-1&&t%1==0&&t1?"& ":"")+e[i],e=e.join(n>2?", ":" "),t.replace(lt,"{\n/* [wrapped with "+e+"] */\n")}(i,function(t,e){return Te(g,(function(n){var i="_."+n[0];e&n[1]&&!Ce(t,i)&&t.push(i)})),t.sort()}(function(t){var e=t.match(ct);return e?e[1].split(Ot):[]}(i),n)))}function Eo(t){var e=0,n=0;return function(){var i=Qn(),o=16-(i-n);if(n=i,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(r,arguments)}}function Vo(t,e){var n=-1,i=t.length,o=i-1;for(e=e===r?i:e;++n1?t[e-1]:r;return n="function"==typeof n?(t.pop(),n):r,ss(t,n)}));function ds(t){var e=Dn(t);return e.__chain__=!0,e}function fs(t,e){return e(t)}var ps=io((function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,o=function(e){return ai(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Ln&&$o(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:fs,args:[o],thisArg:r}),new jn(i,this.__chain__).thru((function(t){return e&&!t.length&&t.push(r),t}))):this.thru(o)}));var ms=zr((function(t,e,n){Vt.call(t,n)?++t[n]:si(t,n,1)}));var gs=Wr(jo),ys=Wr(Lo);function vs(t,e){return(Ls(t)?Te:di)(t,co(e,3))}function $s(t,e){return(Ls(t)?Re:fi)(t,co(e,3))}var Qs=zr((function(t,e,n){Vt.call(t,n)?t[n].push(e):si(t,n,[e])}));var Ss=Hi((function(t,e,n){var r=-1,o="function"==typeof e,s=Ns(t)?i(t.length):[];return di(t,(function(t){s[++r]=o?_e(e,t,n):Xi(t,e,n)})),s})),bs=zr((function(t,e,n){si(t,n,e)}));function ws(t,e){return(Ls(t)?Ee:Yi)(t,co(e,3))}var xs=zr((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]}));var Ps=Hi((function(t,e){if(null==t)return[];var n=e.length;return n>1&&Qo(t,e[0],e[1])?e=[]:n>2&&Qo(e[0],e[1],e[2])&&(e=[e[0]]),Li(t,yi(e,1),[])})),_s=Oe||function(){return pe.Date.now()};function ks(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,Kr(t,h,r,r,r,r,e)}function Ts(t,e){var n;if("function"!=typeof e)throw new Rt(o);return t=pa(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=r),n}}var Rs=Hi((function(t,e,n){var i=1;if(n.length){var r=hn(n,lo(Rs));i|=c}return Kr(t,i,e,n,r)})),Xs=Hi((function(t,e,n){var i=3;if(n.length){var r=hn(n,lo(Xs));i|=c}return Kr(e,i,t,n,r)}));function zs(t,e,n){var i,s,a,l,c,O,h=0,u=!1,d=!1,f=!0;if("function"!=typeof t)throw new Rt(o);function p(e){var n=i,o=s;return i=s=r,h=e,l=t.apply(o,n)}function m(t){var n=t-O;return O===r||n>=e||n<0||d&&t-h>=a}function g(){var t=_s();if(m(t))return y(t);c=zo(g,function(t){var n=e-(t-O);return d?$n(n,a-(t-h)):n}(t))}function y(t){return c=r,f&&i?p(t):(i=s=r,l)}function v(){var t=_s(),n=m(t);if(i=arguments,s=this,O=t,n){if(c===r)return function(t){return h=t,c=zo(g,e),u?p(t):l}(O);if(d)return br(c),c=zo(g,e),p(O)}return c===r&&(c=zo(g,e)),l}return e=ga(e)||0,ea(n)&&(u=!!n.leading,a=(d="maxWait"in n)?vn(ga(n.maxWait)||0,e):a,f="trailing"in n?!!n.trailing:f),v.cancel=function(){c!==r&&br(c),h=0,i=O=s=c=r},v.flush=function(){return c===r?l:y(_s())},v}var Cs=Hi((function(t,e){return hi(t,1,e)})),qs=Hi((function(t,e,n){return hi(t,ga(e)||0,n)}));function Es(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Rt(o);var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var s=t.apply(this,i);return n.cache=o.set(r,s)||o,s};return n.cache=new(Es.Cache||Gn),n}function Vs(t){if("function"!=typeof t)throw new Rt(o);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Es.Cache=Gn;var Zs=Qr((function(t,e){var n=(e=1==e.length&&Ls(e[0])?Ee(e[0],Je(co())):Ee(yi(e,1),Je(co()))).length;return Hi((function(i){for(var r=-1,o=$n(i.length,n);++r=e})),js=zi(function(){return arguments}())?zi:function(t){return na(t)&&Vt.call(t,"callee")&&!Bt.call(t,"callee")},Ls=i.isArray,Is=Qe?Je(Qe):function(t){return na(t)&&Pi(t)==q};function Ns(t){return null!=t&&ta(t.length)&&!Ks(t)}function Gs(t){return na(t)&&Ns(t)}var Bs=ve||gl,Fs=Se?Je(Se):function(t){return na(t)&&Pi(t)==Q};function Hs(t){if(!na(t))return!1;var e=Pi(t);return e==S||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!oa(t)}function Ks(t){if(!ea(t))return!1;var e=Pi(t);return e==b||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Js(t){return"number"==typeof t&&t==pa(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var ia=be?Je(be):function(t){return na(t)&&mo(t)==x};function ra(t){return"number"==typeof t||na(t)&&Pi(t)==P}function oa(t){if(!na(t)||Pi(t)!=_)return!1;var e=Nt(t);if(null===e)return!0;var n=Vt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Et.call(n)==Yt}var sa=we?Je(we):function(t){return na(t)&&Pi(t)==T};var aa=xe?Je(xe):function(t){return na(t)&&mo(t)==R};function la(t){return"string"==typeof t||!Ls(t)&&na(t)&&Pi(t)==X}function ca(t){return"symbol"==typeof t||na(t)&&Pi(t)==z}var Oa=Pe?Je(Pe):function(t){return na(t)&&ta(t.length)&&!!le[Pi(t)]};var ha=Nr(Wi),ua=Nr((function(t,e){return t<=e}));function da(t){if(!t)return[];if(Ns(t))return la(t)?pn(t):Rr(t);if(Kt&&t[Kt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Kt]());var e=mo(t);return(e==x?cn:e==R?un:Da)(t)}function fa(t){return t?(t=ga(t))===d||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function pa(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ma(t){return t?li(pa(t),0,m):0}function ga(t){if("number"==typeof t)return t;if(ca(t))return p;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ke(t);var n=gt.test(t);return n||vt.test(t)?ue(t.slice(2),n?2:8):mt.test(t)?p:+t}function ya(t){return Xr(t,Ca(t))}function va(t){return null==t?"":Or(t)}var $a=Cr((function(t,e){if(xo(e)||Ns(e))Xr(e,za(e),t);else for(var n in e)Vt.call(e,n)&&ni(t,n,e[n])})),Qa=Cr((function(t,e){Xr(e,Ca(e),t)})),Sa=Cr((function(t,e,n,i){Xr(e,Ca(e),t,i)})),ba=Cr((function(t,e,n,i){Xr(e,za(e),t,i)})),wa=io(ai);var xa=Hi((function(t,e){t=_t(t);var n=-1,i=e.length,o=i>2?e[2]:r;for(o&&Qo(e[0],e[1],o)&&(i=1);++n1),e})),Xr(t,oo(t),n),i&&(n=ci(n,7,eo));for(var r=e.length;r--;)ur(n,e[r]);return n}));var Za=io((function(t,e){return null==t?{}:function(t,e){return Ii(t,e,(function(e,n){return ka(t,n)}))}(t,e)}));function Aa(t,e){if(null==t)return{};var n=Ee(oo(t),(function(t){return[t]}));return e=co(e),Ii(t,n,(function(t,n){return e(t,n[0])}))}var Wa=Hr(za),Ya=Hr(Ca);function Da(t){return null==t?[]:tn(t,za(t))}var Ua=Zr((function(t,e,n){return e=e.toLowerCase(),t+(n?Ma(e):e)}));function Ma(t){return Ha(va(t).toLowerCase())}function ja(t){return(t=va(t))&&t.replace(Qt,on).replace(ee,"")}var La=Zr((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),Ia=Zr((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Na=Vr("toLowerCase");var Ga=Zr((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));var Ba=Zr((function(t,e,n){return t+(n?" ":"")+Ha(e)}));var Fa=Zr((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Ha=Vr("toUpperCase");function Ka(t,e,n){return t=va(t),(e=n?r:e)===r?function(t){return oe.test(t)}(t)?function(t){return t.match(ie)||[]}(t):function(t){return t.match(ht)||[]}(t):t.match(e)||[]}var Ja=Hi((function(t,e){try{return _e(t,r,e)}catch(t){return Hs(t)?t:new wt(t)}})),tl=io((function(t,e){return Te(e,(function(e){e=Ao(e),si(t,e,Rs(t[e],t))})),t}));function el(t){return function(){return t}}var nl=Yr(),il=Yr(!0);function rl(t){return t}function ol(t){return Vi("function"==typeof t?t:ci(t,1))}var sl=Hi((function(t,e){return function(n){return Xi(n,t,e)}})),al=Hi((function(t,e){return function(n){return Xi(t,n,e)}}));function ll(t,e,n){var i=za(e),r=bi(e,i);null!=n||ea(e)&&(r.length||!i.length)||(n=e,e=t,t=this,r=bi(e,za(e)));var o=!(ea(n)&&"chain"in n&&!n.chain),s=Ks(t);return Te(r,(function(n){var i=e[n];t[n]=i,s&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Rr(this.__actions__)).push({func:i,args:arguments,thisArg:t}),n.__chain__=e,n}return i.apply(t,Ve([this.value()],arguments))})})),t}function cl(){}var Ol=jr(Ee),hl=jr(Xe),ul=jr(We);function dl(t){return So(t)?Ne(Ao(t)):function(t){return function(e){return wi(e,t)}}(t)}var fl=Ir(),pl=Ir(!0);function ml(){return[]}function gl(){return!1}var yl=Mr((function(t,e){return t+e}),0),vl=Br("ceil"),$l=Mr((function(t,e){return t/e}),1),Ql=Br("floor");var Sl,bl=Mr((function(t,e){return t*e}),1),wl=Br("round"),xl=Mr((function(t,e){return t-e}),0);return Dn.after=function(t,e){if("function"!=typeof e)throw new Rt(o);return t=pa(t),function(){if(--t<1)return e.apply(this,arguments)}},Dn.ary=ks,Dn.assign=$a,Dn.assignIn=Qa,Dn.assignInWith=Sa,Dn.assignWith=ba,Dn.at=wa,Dn.before=Ts,Dn.bind=Rs,Dn.bindAll=tl,Dn.bindKey=Xs,Dn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ls(t)?t:[t]},Dn.chain=ds,Dn.chunk=function(t,e,n){e=(n?Qo(t,e,n):e===r)?1:vn(pa(e),0);var o=null==t?0:t.length;if(!o||e<1)return[];for(var s=0,a=0,l=i(fe(o/e));so?0:o+n),(i=i===r||i>o?o:pa(i))<0&&(i+=o),i=n>i?0:ma(i);n>>0)?(t=va(t))&&("string"==typeof e||null!=e&&!sa(e))&&!(e=Or(e))&&ln(t)?Sr(pn(t),0,n):t.split(e,n):[]},Dn.spread=function(t,e){if("function"!=typeof t)throw new Rt(o);return e=null==e?0:vn(pa(e),0),Hi((function(n){var i=n[e],r=Sr(n,0,e);return i&&Ve(r,i),_e(t,this,r)}))},Dn.tail=function(t){var e=null==t?0:t.length;return e?rr(t,1,e):[]},Dn.take=function(t,e,n){return t&&t.length?rr(t,0,(e=n||e===r?1:pa(e))<0?0:e):[]},Dn.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?rr(t,(e=i-(e=n||e===r?1:pa(e)))<0?0:e,i):[]},Dn.takeRightWhile=function(t,e){return t&&t.length?fr(t,co(e,3),!1,!0):[]},Dn.takeWhile=function(t,e){return t&&t.length?fr(t,co(e,3)):[]},Dn.tap=function(t,e){return e(t),t},Dn.throttle=function(t,e,n){var i=!0,r=!0;if("function"!=typeof t)throw new Rt(o);return ea(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),zs(t,e,{leading:i,maxWait:e,trailing:r})},Dn.thru=fs,Dn.toArray=da,Dn.toPairs=Wa,Dn.toPairsIn=Ya,Dn.toPath=function(t){return Ls(t)?Ee(t,Ao):ca(t)?[t]:Rr(Zo(va(t)))},Dn.toPlainObject=ya,Dn.transform=function(t,e,n){var i=Ls(t),r=i||Bs(t)||Oa(t);if(e=co(e,4),null==n){var o=t&&t.constructor;n=r?i?new o:[]:ea(t)&&Ks(o)?Un(Nt(t)):{}}return(r?Te:Qi)(t,(function(t,i,r){return e(n,t,i,r)})),n},Dn.unary=function(t){return ks(t,1)},Dn.union=ns,Dn.unionBy=is,Dn.unionWith=rs,Dn.uniq=function(t){return t&&t.length?hr(t):[]},Dn.uniqBy=function(t,e){return t&&t.length?hr(t,co(e,2)):[]},Dn.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?hr(t,r,e):[]},Dn.unset=function(t,e){return null==t||ur(t,e)},Dn.unzip=os,Dn.unzipWith=ss,Dn.update=function(t,e,n){return null==t?t:dr(t,e,vr(n))},Dn.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:dr(t,e,vr(n),i)},Dn.values=Da,Dn.valuesIn=function(t){return null==t?[]:tn(t,Ca(t))},Dn.without=as,Dn.words=Ka,Dn.wrap=function(t,e){return As(vr(e),t)},Dn.xor=ls,Dn.xorBy=cs,Dn.xorWith=Os,Dn.zip=hs,Dn.zipObject=function(t,e){return gr(t||[],e||[],ni)},Dn.zipObjectDeep=function(t,e){return gr(t||[],e||[],tr)},Dn.zipWith=us,Dn.entries=Wa,Dn.entriesIn=Ya,Dn.extend=Qa,Dn.extendWith=Sa,ll(Dn,Dn),Dn.add=yl,Dn.attempt=Ja,Dn.camelCase=Ua,Dn.capitalize=Ma,Dn.ceil=vl,Dn.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=ga(n))==n?n:0),e!==r&&(e=(e=ga(e))==e?e:0),li(ga(t),e,n)},Dn.clone=function(t){return ci(t,4)},Dn.cloneDeep=function(t){return ci(t,5)},Dn.cloneDeepWith=function(t,e){return ci(t,5,e="function"==typeof e?e:r)},Dn.cloneWith=function(t,e){return ci(t,4,e="function"==typeof e?e:r)},Dn.conformsTo=function(t,e){return null==e||Oi(t,e,za(e))},Dn.deburr=ja,Dn.defaultTo=function(t,e){return null==t||t!=t?e:t},Dn.divide=$l,Dn.endsWith=function(t,e,n){t=va(t),e=Or(e);var i=t.length,o=n=n===r?i:li(pa(n),0,i);return(n-=e.length)>=0&&t.slice(n,o)==e},Dn.eq=Ds,Dn.escape=function(t){return(t=va(t))&&H.test(t)?t.replace(B,sn):t},Dn.escapeRegExp=function(t){return(t=va(t))&&ot.test(t)?t.replace(rt,"\\$&"):t},Dn.every=function(t,e,n){var i=Ls(t)?Xe:pi;return n&&Qo(t,e,n)&&(e=r),i(t,co(e,3))},Dn.find=gs,Dn.findIndex=jo,Dn.findKey=function(t,e){return De(t,co(e,3),Qi)},Dn.findLast=ys,Dn.findLastIndex=Lo,Dn.findLastKey=function(t,e){return De(t,co(e,3),Si)},Dn.floor=Ql,Dn.forEach=vs,Dn.forEachRight=$s,Dn.forIn=function(t,e){return null==t?t:vi(t,co(e,3),Ca)},Dn.forInRight=function(t,e){return null==t?t:$i(t,co(e,3),Ca)},Dn.forOwn=function(t,e){return t&&Qi(t,co(e,3))},Dn.forOwnRight=function(t,e){return t&&Si(t,co(e,3))},Dn.get=_a,Dn.gt=Us,Dn.gte=Ms,Dn.has=function(t,e){return null!=t&&go(t,e,ki)},Dn.hasIn=ka,Dn.head=No,Dn.identity=rl,Dn.includes=function(t,e,n,i){t=Ns(t)?t:Da(t),n=n&&!i?pa(n):0;var r=t.length;return n<0&&(n=vn(r+n,0)),la(t)?n<=r&&t.indexOf(e,n)>-1:!!r&&Me(t,e,n)>-1},Dn.indexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var r=null==n?0:pa(n);return r<0&&(r=vn(i+r,0)),Me(t,e,r)},Dn.inRange=function(t,e,n){return e=fa(e),n===r?(n=e,e=0):n=fa(n),function(t,e,n){return t>=$n(e,n)&&t=-9007199254740991&&t<=f},Dn.isSet=aa,Dn.isString=la,Dn.isSymbol=ca,Dn.isTypedArray=Oa,Dn.isUndefined=function(t){return t===r},Dn.isWeakMap=function(t){return na(t)&&mo(t)==C},Dn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Pi(t)},Dn.join=function(t,e){return null==t?"":Ye.call(t,e)},Dn.kebabCase=La,Dn.last=Ho,Dn.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=pa(n))<0?vn(i+o,0):$n(o,i-1)),e==e?function(t,e,n){for(var i=n+1;i--;)if(t[i]===e)return i;return i}(t,e,o):Ue(t,Le,o,!0)},Dn.lowerCase=Ia,Dn.lowerFirst=Na,Dn.lt=ha,Dn.lte=ua,Dn.max=function(t){return t&&t.length?mi(t,rl,_i):r},Dn.maxBy=function(t,e){return t&&t.length?mi(t,co(e,2),_i):r},Dn.mean=function(t){return Ie(t,rl)},Dn.meanBy=function(t,e){return Ie(t,co(e,2))},Dn.min=function(t){return t&&t.length?mi(t,rl,Wi):r},Dn.minBy=function(t,e){return t&&t.length?mi(t,co(e,2),Wi):r},Dn.stubArray=ml,Dn.stubFalse=gl,Dn.stubObject=function(){return{}},Dn.stubString=function(){return""},Dn.stubTrue=function(){return!0},Dn.multiply=bl,Dn.nth=function(t,e){return t&&t.length?ji(t,pa(e)):r},Dn.noConflict=function(){return pe._===this&&(pe._=Dt),this},Dn.noop=cl,Dn.now=_s,Dn.pad=function(t,e,n){t=va(t);var i=(e=pa(e))?fn(t):0;if(!e||i>=e)return t;var r=(e-i)/2;return Lr(me(r),n)+t+Lr(fe(r),n)},Dn.padEnd=function(t,e,n){t=va(t);var i=(e=pa(e))?fn(t):0;return e&&ie){var i=t;t=e,e=i}if(n||t%1||e%1){var o=bn();return $n(t+o*(e-t+he("1e-"+((o+"").length-1))),e)}return Bi(t,e)},Dn.reduce=function(t,e,n){var i=Ls(t)?Ze:Be,r=arguments.length<3;return i(t,co(e,4),n,r,di)},Dn.reduceRight=function(t,e,n){var i=Ls(t)?Ae:Be,r=arguments.length<3;return i(t,co(e,4),n,r,fi)},Dn.repeat=function(t,e,n){return e=(n?Qo(t,e,n):e===r)?1:pa(e),Fi(va(t),e)},Dn.replace=function(){var t=arguments,e=va(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Dn.result=function(t,e,n){var i=-1,o=(e=$r(e,t)).length;for(o||(o=1,t=r);++if)return[];var n=m,i=$n(t,m);e=co(e),t-=m;for(var r=He(i,e);++n=s)return t;var l=n-fn(i);if(l<1)return i;var c=a?Sr(a,0,l).join(""):t.slice(0,l);if(o===r)return c+i;if(a&&(l+=c.length-l),sa(o)){if(t.slice(l).search(o)){var O,h=c;for(o.global||(o=kt(o.source,va(pt.exec(o))+"g")),o.lastIndex=0;O=o.exec(h);)var u=O.index;c=c.slice(0,u===r?l:u)}}else if(t.indexOf(Or(o),l)!=l){var d=c.lastIndexOf(o);d>-1&&(c=c.slice(0,d))}return c+i},Dn.unescape=function(t){return(t=va(t))&&F.test(t)?t.replace(G,gn):t},Dn.uniqueId=function(t){var e=++Zt;return va(t)+e},Dn.upperCase=Fa,Dn.upperFirst=Ha,Dn.each=vs,Dn.eachRight=$s,Dn.first=No,ll(Dn,(Sl={},Qi(Dn,(function(t,e){Vt.call(Dn.prototype,e)||(Sl[e]=t)})),Sl),{chain:!1}),Dn.VERSION="4.17.21",Te(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Dn[t].placeholder=Dn})),Te(["drop","take"],(function(t,e){Ln.prototype[t]=function(n){n=n===r?1:vn(pa(n),0);var i=this.__filtered__&&!e?new Ln(this):this.clone();return i.__filtered__?i.__takeCount__=$n(n,i.__takeCount__):i.__views__.push({size:$n(n,m),type:t+(i.__dir__<0?"Right":"")}),i},Ln.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Te(["filter","map","takeWhile"],(function(t,e){var n=e+1,i=1==n||3==n;Ln.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:co(t,3),type:n}),e.__filtered__=e.__filtered__||i,e}})),Te(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Ln.prototype[t]=function(){return this[n](1).value()[0]}})),Te(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Ln.prototype[t]=function(){return this.__filtered__?new Ln(this):this[n](1)}})),Ln.prototype.compact=function(){return this.filter(rl)},Ln.prototype.find=function(t){return this.filter(t).head()},Ln.prototype.findLast=function(t){return this.reverse().find(t)},Ln.prototype.invokeMap=Hi((function(t,e){return"function"==typeof t?new Ln(this):this.map((function(n){return Xi(n,t,e)}))})),Ln.prototype.reject=function(t){return this.filter(Vs(co(t)))},Ln.prototype.slice=function(t,e){t=pa(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Ln(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==r&&(n=(e=pa(e))<0?n.dropRight(-e):n.take(e-t)),n)},Ln.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Ln.prototype.toArray=function(){return this.take(m)},Qi(Ln.prototype,(function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Dn[i?"take"+("last"==e?"Right":""):e],s=i||/^find/.test(e);o&&(Dn.prototype[e]=function(){var e=this.__wrapped__,a=i?[1]:arguments,l=e instanceof Ln,c=a[0],O=l||Ls(e),h=function(t){var e=o.apply(Dn,Ve([t],a));return i&&u?e[0]:e};O&&n&&"function"==typeof c&&1!=c.length&&(l=O=!1);var u=this.__chain__,d=!!this.__actions__.length,f=s&&!u,p=l&&!d;if(!s&&O){e=p?e:new Ln(this);var m=t.apply(e,a);return m.__actions__.push({func:fs,args:[h],thisArg:r}),new jn(m,u)}return f&&p?t.apply(this,a):(m=this.thru(h),f?i?m.value()[0]:m.value():m)})})),Te(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Xt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:pop|shift)$/.test(t);Dn.prototype[t]=function(){var t=arguments;if(i&&!this.__chain__){var r=this.value();return e.apply(Ls(r)?r:[],t)}return this[n]((function(n){return e.apply(Ls(n)?n:[],t)}))}})),Qi(Ln.prototype,(function(t,e){var n=Dn[e];if(n){var i=n.name+"";Vt.call(zn,i)||(zn[i]=[]),zn[i].push({name:e,func:n})}})),zn[Dr(r,2).name]=[{name:"wrapper",func:r}],Ln.prototype.clone=function(){var t=new Ln(this.__wrapped__);return t.__actions__=Rr(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Rr(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Rr(this.__views__),t},Ln.prototype.reverse=function(){if(this.__filtered__){var t=new Ln(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Ln.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Ls(t),i=e<0,r=n?t.length:0,o=function(t,e,n){var i=-1,r=n.length;for(;++i=this.__values__.length;return{done:t,value:t?r:this.__values__[this.__index__++]}},Dn.prototype.plant=function(t){for(var e,n=this;n instanceof Mn;){var i=Yo(n);i.__index__=0,i.__values__=r,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e},Dn.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Ln){var e=t;return this.__actions__.length&&(e=new Ln(this)),(e=e.reverse()).__actions__.push({func:fs,args:[es],thisArg:r}),new jn(e,this.__chain__)}return this.thru(es)},Dn.prototype.toJSON=Dn.prototype.valueOf=Dn.prototype.value=function(){return pr(this.__wrapped__,this.__actions__)},Dn.prototype.first=Dn.prototype.head,Kt&&(Dn.prototype[Kt]=function(){return this}),Dn}();pe._=yn,(i=function(){return yn}.call(e,n,e,t))===r||(t.exports=i)}.call(this)},569:function(t){t.exports=function(){"use strict";var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,r){var o,s=function(t,n,i){void 0===i&&(i={});var r=new Date(t),o=function(t,n){void 0===n&&(n={});var i=n.timeZoneName||"short",r=t+"|"+i,o=e[r];return o||(o=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[r]=o),o}(n,i);return o.formatToParts(r)},a=function(e,n){for(var i=s(e,n),o=[],a=0;a=0&&(o[h]=parseInt(O,10))}var u=o[3],d=24===u?0:u,f=o[0]+"-"+o[1]+"-"+o[2]+" "+d+":"+o[4]+":"+o[5]+":000",p=+e;return(r.utc(f).valueOf()-(p-=p%1e3))/6e4},l=i.prototype;l.tz=function(t,e){void 0===t&&(t=o);var n,i=this.utcOffset(),s=this.toDate(),a=s.toLocaleString("en-US",{timeZone:t}),l=Math.round((s-new Date(a))/1e3/60),c=15*-Math.round(s.getTimezoneOffset()/15)-l;if(Number(c)){if(n=r(a,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(c,!0),e){var O=n.utcOffset();n=n.add(i-O,"minute")}}else n=this.utcOffset(0,e);return n.$x.$timezone=t,n},l.offsetName=function(t){var e=this.$x.$timezone||r.tz.guess(),n=s(this.valueOf(),e,{timeZoneName:t}).find((function(t){return"timezonename"===t.type.toLowerCase()}));return n&&n.value};var c=l.startOf;l.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return c.call(this,t,e);var n=r(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return c.call(n,t,e).tz(this.$x.$timezone,!0)},r.tz=function(t,e,n){var i=n&&e,s=n||e||o,l=a(+r(),s);if("string"!=typeof t)return r(t).tz(s);var c=function(t,e,n){var i=t-60*e*1e3,r=a(i,n);if(e===r)return[i,e];var o=a(i-=60*(r-e)*1e3,n);return r===o?[i,r]:[t-60*Math.min(r,o)*1e3,Math.max(r,o)]}(r.utc(t,i).valueOf(),l,s),O=c[0],h=c[1],u=r(O).utcOffset(h);return u.$x.$timezone=s,u},r.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},r.tz.setDefault=function(t){o=t}}}()},606:t=>{var e,n,i=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:r}catch(t){e=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var a,l=[],c=!1,O=-1;function h(){c&&a&&(c=!1,a.length?l=a.concat(l):O=-1,l.length&&u())}function u(){if(!c){var t=s(h);c=!0;for(var e=l.length;e;){for(a=l,l=[];++O1)for(var n=1;n{var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},688:()=>{},692:function(t,e){var n;!function(e,n){"use strict";"object"==typeof t.exports?t.exports=e.document?n(e,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return n(t)}:n(e)}("undefined"!=typeof window?window:this,(function(i,r){"use strict";var o=[],s=Object.getPrototypeOf,a=o.slice,l=o.flat?function(t){return o.flat.call(t)}:function(t){return o.concat.apply([],t)},c=o.push,O=o.indexOf,h={},u=h.toString,d=h.hasOwnProperty,f=d.toString,p=f.call(Object),m={},g=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType&&"function"!=typeof t.item},y=function(t){return null!=t&&t===t.window},v=i.document,$={type:!0,src:!0,nonce:!0,noModule:!0};function Q(t,e,n){var i,r,o=(n=n||v).createElement("script");if(o.text=t,e)for(i in $)(r=e[i]||e.getAttribute&&e.getAttribute(i))&&o.setAttribute(i,r);n.head.appendChild(o).parentNode.removeChild(o)}function S(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?h[u.call(t)]||"object":typeof t}var b="3.7.1",w=/HTML$/i,x=function(t,e){return new x.fn.init(t,e)};function P(t){var e=!!t&&"length"in t&&t.length,n=S(t);return!g(t)&&!y(t)&&("array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function _(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}x.fn=x.prototype={jquery:b,constructor:x,length:0,toArray:function(){return a.call(this)},get:function(t){return null==t?a.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=x.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return x.each(this,t)},map:function(t){return this.pushStack(x.map(this,(function(e,n){return t.call(e,n,e)})))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(x.grep(this,(function(t,e){return(e+1)%2})))},odd:function(){return this.pushStack(x.grep(this,(function(t,e){return e%2})))},eq:function(t){var e=this.length,n=+t+(t<0?e:0);return this.pushStack(n>=0&&n+~]|"+X+")"+X+"*"),D=new RegExp(X+"|>"),U=new RegExp(Z),M=new RegExp("^"+C+"$"),j={ID:new RegExp("^#("+C+")"),CLASS:new RegExp("^\\.("+C+")"),TAG:new RegExp("^("+C+"|[*])"),ATTR:new RegExp("^"+q),PSEUDO:new RegExp("^"+Z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+X+"*(even|odd|(([+-]|)(\\d*)n|)"+X+"*(?:([+-]|)"+X+"*(\\d+)|))"+X+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+X+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+X+"*((?:-\\d)?\\d*)"+X+"*\\)|)(?=[^-]|$)","i")},L=/^(?:input|select|textarea|button)$/i,I=/^h\d$/i,N=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/[+~]/,B=new RegExp("\\\\[\\da-fA-F]{1,6}"+X+"?|\\\\([^\\r\\n\\f])","g"),F=function(t,e){var n="0x"+t.slice(1)-65536;return e||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},H=function(){lt()},K=ut((function(t){return!0===t.disabled&&_(t,"fieldset")}),{dir:"parentNode",next:"legend"});try{p.apply(o=a.call(E.childNodes),E.childNodes),o[E.childNodes.length].nodeType}catch(t){p={apply:function(t,e){V.apply(t,a.call(e))},call:function(t){V.apply(t,a.call(arguments,1))}}}function J(t,e,n,i){var r,o,s,a,c,O,d,f=e&&e.ownerDocument,y=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==y&&9!==y&&11!==y)return n;if(!i&&(lt(e),e=e||l,h)){if(11!==y&&(c=N.exec(t)))if(r=c[1]){if(9===y){if(!(s=e.getElementById(r)))return n;if(s.id===r)return p.call(n,s),n}else if(f&&(s=f.getElementById(r))&&J.contains(e,s)&&s.id===r)return p.call(n,s),n}else{if(c[2])return p.apply(n,e.getElementsByTagName(t)),n;if((r=c[3])&&e.getElementsByClassName)return p.apply(n,e.getElementsByClassName(r)),n}if(!(b[t+" "]||u&&u.test(t))){if(d=t,f=e,1===y&&(D.test(t)||Y.test(t))){for((f=G.test(t)&&at(e.parentNode)||e)==e&&m.scope||((a=e.getAttribute("id"))?a=x.escapeSelector(a):e.setAttribute("id",a=g)),o=(O=Ot(t)).length;o--;)O[o]=(a?"#"+a:":scope")+" "+ht(O[o]);d=O.join(",")}try{return p.apply(n,f.querySelectorAll(d)),n}catch(e){b(t,!0)}finally{a===g&&e.removeAttribute("id")}}}return yt(t.replace(z,"$1"),e,n,i)}function tt(){var t=[];return function n(i,r){return t.push(i+" ")>e.cacheLength&&delete n[t.shift()],n[i+" "]=r}}function et(t){return t[g]=!0,t}function nt(t){var e=l.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function it(t){return function(e){return _(e,"input")&&e.type===t}}function rt(t){return function(e){return(_(e,"input")||_(e,"button"))&&e.type===t}}function ot(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&K(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function st(t){return et((function(e){return e=+e,et((function(n,i){for(var r,o=t([],n.length,e),s=o.length;s--;)n[r=o[s]]&&(n[r]=!(i[r]=n[r]))}))}))}function at(t){return t&&void 0!==t.getElementsByTagName&&t}function lt(t){var n,i=t?t.ownerDocument||t:E;return i!=l&&9===i.nodeType&&i.documentElement?(c=(l=i).documentElement,h=!x.isXMLDoc(l),f=c.matches||c.webkitMatchesSelector||c.msMatchesSelector,c.msMatchesSelector&&E!=l&&(n=l.defaultView)&&n.top!==n&&n.addEventListener("unload",H),m.getById=nt((function(t){return c.appendChild(t).id=x.expando,!l.getElementsByName||!l.getElementsByName(x.expando).length})),m.disconnectedMatch=nt((function(t){return f.call(t,"*")})),m.scope=nt((function(){return l.querySelectorAll(":scope")})),m.cssHas=nt((function(){try{return l.querySelector(":has(*,:jqfake)"),!1}catch(t){return!0}})),m.getById?(e.filter.ID=function(t){var e=t.replace(B,F);return function(t){return t.getAttribute("id")===e}},e.find.ID=function(t,e){if(void 0!==e.getElementById&&h){var n=e.getElementById(t);return n?[n]:[]}}):(e.filter.ID=function(t){var e=t.replace(B,F);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},e.find.ID=function(t,e){if(void 0!==e.getElementById&&h){var n,i,r,o=e.getElementById(t);if(o){if((n=o.getAttributeNode("id"))&&n.value===t)return[o];for(r=e.getElementsByName(t),i=0;o=r[i++];)if((n=o.getAttributeNode("id"))&&n.value===t)return[o]}return[]}}),e.find.TAG=function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):e.querySelectorAll(t)},e.find.CLASS=function(t,e){if(void 0!==e.getElementsByClassName&&h)return e.getElementsByClassName(t)},u=[],nt((function(t){var e;c.appendChild(t).innerHTML="",t.querySelectorAll("[selected]").length||u.push("\\["+X+"*(?:value|"+P+")"),t.querySelectorAll("[id~="+g+"-]").length||u.push("~="),t.querySelectorAll("a#"+g+"+*").length||u.push(".#.+[+~]"),t.querySelectorAll(":checked").length||u.push(":checked"),(e=l.createElement("input")).setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),c.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&u.push(":enabled",":disabled"),(e=l.createElement("input")).setAttribute("name",""),t.appendChild(e),t.querySelectorAll("[name='']").length||u.push("\\["+X+"*name"+X+"*="+X+"*(?:''|\"\")")})),m.cssHas||u.push(":has"),u=u.length&&new RegExp(u.join("|")),w=function(t,e){if(t===e)return s=!0,0;var n=!t.compareDocumentPosition-!e.compareDocumentPosition;return n||(1&(n=(t.ownerDocument||t)==(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!m.sortDetached&&e.compareDocumentPosition(t)===n?t===l||t.ownerDocument==E&&J.contains(E,t)?-1:e===l||e.ownerDocument==E&&J.contains(E,e)?1:r?O.call(r,t)-O.call(r,e):0:4&n?-1:1)},l):l}for(t in J.matches=function(t,e){return J(t,null,null,e)},J.matchesSelector=function(t,e){if(lt(t),h&&!b[e+" "]&&(!u||!u.test(e)))try{var n=f.call(t,e);if(n||m.disconnectedMatch||t.document&&11!==t.document.nodeType)return n}catch(t){b(e,!0)}return J(e,l,null,[t]).length>0},J.contains=function(t,e){return(t.ownerDocument||t)!=l&<(t),x.contains(t,e)},J.attr=function(t,n){(t.ownerDocument||t)!=l&<(t);var i=e.attrHandle[n.toLowerCase()],r=i&&d.call(e.attrHandle,n.toLowerCase())?i(t,n,!h):void 0;return void 0!==r?r:t.getAttribute(n)},J.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},x.uniqueSort=function(t){var e,n=[],i=0,o=0;if(s=!m.sortStable,r=!m.sortStable&&a.call(t,0),T.call(t,w),s){for(;e=t[o++];)e===t[o]&&(i=n.push(o));for(;i--;)R.call(t,n[i],1)}return r=null,t},x.fn.uniqueSort=function(){return this.pushStack(x.uniqueSort(a.apply(this)))},e=x.expr={cacheLength:50,createPseudo:et,match:j,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(B,F),t[3]=(t[3]||t[4]||t[5]||"").replace(B,F),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||J.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&J.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return j.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&U.test(n)&&(e=Ot(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(B,F).toLowerCase();return"*"===t?function(){return!0}:function(t){return _(t,e)}},CLASS:function(t){var e=$[t+" "];return e||(e=new RegExp("(^|"+X+")"+t+"("+X+"|$)"))&&$(t,(function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")}))},ATTR:function(t,e,n){return function(i){var r=J.attr(i,t);return null==r?"!="===e:!e||(r+="","="===e?r===n:"!="===e?r!==n:"^="===e?n&&0===r.indexOf(n):"*="===e?n&&r.indexOf(n)>-1:"$="===e?n&&r.slice(-n.length)===n:"~="===e?(" "+r.replace(A," ")+" ").indexOf(n)>-1:"|="===e&&(r===n||r.slice(0,n.length+1)===n+"-"))}},CHILD:function(t,e,n,i,r){var o="nth"!==t.slice(0,3),s="last"!==t.slice(-4),a="of-type"===e;return 1===i&&0===r?function(t){return!!t.parentNode}:function(e,n,l){var c,O,h,u,d,f=o!==s?"nextSibling":"previousSibling",p=e.parentNode,m=a&&e.nodeName.toLowerCase(),v=!l&&!a,$=!1;if(p){if(o){for(;f;){for(h=e;h=h[f];)if(a?_(h,m):1===h.nodeType)return!1;d=f="only"===t&&!d&&"nextSibling"}return!0}if(d=[s?p.firstChild:p.lastChild],s&&v){for($=(u=(c=(O=p[g]||(p[g]={}))[t]||[])[0]===y&&c[1])&&c[2],h=u&&p.childNodes[u];h=++u&&h&&h[f]||($=u=0)||d.pop();)if(1===h.nodeType&&++$&&h===e){O[t]=[y,u,$];break}}else if(v&&($=u=(c=(O=e[g]||(e[g]={}))[t]||[])[0]===y&&c[1]),!1===$)for(;(h=++u&&h&&h[f]||($=u=0)||d.pop())&&(!(a?_(h,m):1===h.nodeType)||!++$||(v&&((O=h[g]||(h[g]={}))[t]=[y,$]),h!==e)););return($-=r)===i||$%i==0&&$/i>=0}}},PSEUDO:function(t,n){var i,r=e.pseudos[t]||e.setFilters[t.toLowerCase()]||J.error("unsupported pseudo: "+t);return r[g]?r(n):r.length>1?(i=[t,t,"",n],e.setFilters.hasOwnProperty(t.toLowerCase())?et((function(t,e){for(var i,o=r(t,n),s=o.length;s--;)t[i=O.call(t,o[s])]=!(e[i]=o[s])})):function(t){return r(t,0,i)}):r}},pseudos:{not:et((function(t){var e=[],n=[],i=gt(t.replace(z,"$1"));return i[g]?et((function(t,e,n,r){for(var o,s=i(t,null,r,[]),a=t.length;a--;)(o=s[a])&&(t[a]=!(e[a]=o))})):function(t,r,o){return e[0]=t,i(e,null,o,n),e[0]=null,!n.pop()}})),has:et((function(t){return function(e){return J(t,e).length>0}})),contains:et((function(t){return t=t.replace(B,F),function(e){return(e.textContent||x.text(e)).indexOf(t)>-1}})),lang:et((function(t){return M.test(t||"")||J.error("unsupported lang: "+t),t=t.replace(B,F).toLowerCase(),function(e){var n;do{if(n=h?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}})),target:function(t){var e=i.location&&i.location.hash;return e&&e.slice(1)===t.id},root:function(t){return t===c},focus:function(t){return t===function(){try{return l.activeElement}catch(t){}}()&&l.hasFocus()&&!!(t.type||t.href||~t.tabIndex)},enabled:ot(!1),disabled:ot(!0),checked:function(t){return _(t,"input")&&!!t.checked||_(t,"option")&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!e.pseudos.empty(t)},header:function(t){return I.test(t.nodeName)},input:function(t){return L.test(t.nodeName)},button:function(t){return _(t,"input")&&"button"===t.type||_(t,"button")},text:function(t){var e;return _(t,"input")&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:st((function(){return[0]})),last:st((function(t,e){return[e-1]})),eq:st((function(t,e,n){return[n<0?n+e:n]})),even:st((function(t,e){for(var n=0;ne?e:n;--i>=0;)t.push(i);return t})),gt:st((function(t,e,n){for(var i=n<0?n+e:n;++i1?function(e,n,i){for(var r=t.length;r--;)if(!t[r](e,n,i))return!1;return!0}:t[0]}function ft(t,e,n,i,r){for(var o,s=[],a=0,l=t.length,c=null!=e;a-1&&(o[c]=!(s[c]=u))}}else d=ft(d===s?d.splice(g,d.length):d),r?r(null,s,d,l):p.apply(s,d)}))}function mt(t){for(var i,r,o,s=t.length,a=e.relative[t[0].type],l=a||e.relative[" "],c=a?1:0,h=ut((function(t){return t===i}),l,!0),u=ut((function(t){return O.call(i,t)>-1}),l,!0),d=[function(t,e,r){var o=!a&&(r||e!=n)||((i=e).nodeType?h(t,e,r):u(t,e,r));return i=null,o}];c1&&dt(d),c>1&&ht(t.slice(0,c-1).concat({value:" "===t[c-2].type?"*":""})).replace(z,"$1"),r,c0,o=t.length>0,s=function(s,a,c,O,u){var d,f,m,g=0,v="0",$=s&&[],Q=[],S=n,b=s||o&&e.find.TAG("*",u),w=y+=null==S?1:Math.random()||.1,P=b.length;for(u&&(n=a==l||a||u);v!==P&&null!=(d=b[v]);v++){if(o&&d){for(f=0,a||d.ownerDocument==l||(lt(d),c=!h);m=t[f++];)if(m(d,a||l,c)){p.call(O,d);break}u&&(y=w)}r&&((d=!m&&d)&&g--,s&&$.push(d))}if(g+=v,r&&v!==g){for(f=0;m=i[f++];)m($,Q,a,c);if(s){if(g>0)for(;v--;)$[v]||Q[v]||(Q[v]=k.call(O));Q=ft(Q)}p.apply(O,Q),u&&!s&&Q.length>0&&g+i.length>1&&x.uniqueSort(O)}return u&&(y=w,n=S),$};return r?et(s):s}(s,o)),a.selector=t}return a}function yt(t,n,i,r){var o,s,a,l,c,O="function"==typeof t&&t,u=!r&&Ot(t=O.selector||t);if(i=i||[],1===u.length){if((s=u[0]=u[0].slice(0)).length>2&&"ID"===(a=s[0]).type&&9===n.nodeType&&h&&e.relative[s[1].type]){if(!(n=(e.find.ID(a.matches[0].replace(B,F),n)||[])[0]))return i;O&&(n=n.parentNode),t=t.slice(s.shift().value.length)}for(o=j.needsContext.test(t)?0:s.length;o--&&(a=s[o],!e.relative[l=a.type]);)if((c=e.find[l])&&(r=c(a.matches[0].replace(B,F),G.test(s[0].type)&&at(n.parentNode)||n))){if(s.splice(o,1),!(t=r.length&&ht(s)))return p.apply(i,r),i;break}}return(O||gt(t,u))(r,n,!h,i,!n||G.test(t)&&at(n.parentNode)||n),i}ct.prototype=e.filters=e.pseudos,e.setFilters=new ct,m.sortStable=g.split("").sort(w).join("")===g,lt(),m.sortDetached=nt((function(t){return 1&t.compareDocumentPosition(l.createElement("fieldset"))})),x.find=J,x.expr[":"]=x.expr.pseudos,x.unique=x.uniqueSort,J.compile=gt,J.select=yt,J.setDocument=lt,J.tokenize=Ot,J.escape=x.escapeSelector,J.getText=x.text,J.isXML=x.isXMLDoc,J.selectors=x.expr,J.support=x.support,J.uniqueSort=x.uniqueSort}();var Z=function(t,e,n){for(var i=[],r=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(r&&x(t).is(n))break;i.push(t)}return i},A=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},W=x.expr.match.needsContext,Y=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(t,e,n){return g(e)?x.grep(t,(function(t,i){return!!e.call(t,i,t)!==n})):e.nodeType?x.grep(t,(function(t){return t===e!==n})):"string"!=typeof e?x.grep(t,(function(t){return O.call(e,t)>-1!==n})):x.filter(e,t,n)}x.filter=function(t,e,n){var i=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===i.nodeType?x.find.matchesSelector(i,t)?[i]:[]:x.find.matches(t,x.grep(e,(function(t){return 1===t.nodeType})))},x.fn.extend({find:function(t){var e,n,i=this.length,r=this;if("string"!=typeof t)return this.pushStack(x(t).filter((function(){for(e=0;e1?x.uniqueSort(n):n},filter:function(t){return this.pushStack(D(this,t||[],!1))},not:function(t){return this.pushStack(D(this,t||[],!0))},is:function(t){return!!D(this,"string"==typeof t&&W.test(t)?x(t):t||[],!1).length}});var U,M=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(x.fn.init=function(t,e,n){var i,r;if(!t)return this;if(n=n||U,"string"==typeof t){if(!(i="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:M.exec(t))||!i[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(i[1]){if(e=e instanceof x?e[0]:e,x.merge(this,x.parseHTML(i[1],e&&e.nodeType?e.ownerDocument||e:v,!0)),Y.test(i[1])&&x.isPlainObject(e))for(i in e)g(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return(r=v.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):g(t)?void 0!==n.ready?n.ready(t):t(x):x.makeArray(t,this)}).prototype=x.fn,U=x(v);var j=/^(?:parents|prev(?:Until|All))/,L={children:!0,contents:!0,next:!0,prev:!0};function I(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}x.fn.extend({has:function(t){var e=x(t,this),n=e.length;return this.filter((function(){for(var t=0;t-1:1===n.nodeType&&x.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?x.uniqueSort(o):o)},index:function(t){return t?"string"==typeof t?O.call(x(t),this[0]):O.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(x.uniqueSort(x.merge(this.get(),x(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),x.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return Z(t,"parentNode")},parentsUntil:function(t,e,n){return Z(t,"parentNode",n)},next:function(t){return I(t,"nextSibling")},prev:function(t){return I(t,"previousSibling")},nextAll:function(t){return Z(t,"nextSibling")},prevAll:function(t){return Z(t,"previousSibling")},nextUntil:function(t,e,n){return Z(t,"nextSibling",n)},prevUntil:function(t,e,n){return Z(t,"previousSibling",n)},siblings:function(t){return A((t.parentNode||{}).firstChild,t)},children:function(t){return A(t.firstChild)},contents:function(t){return null!=t.contentDocument&&s(t.contentDocument)?t.contentDocument:(_(t,"template")&&(t=t.content||t),x.merge([],t.childNodes))}},(function(t,e){x.fn[t]=function(n,i){var r=x.map(this,e,n);return"Until"!==t.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=x.filter(i,r)),this.length>1&&(L[t]||x.uniqueSort(r),j.test(t)&&r.reverse()),this.pushStack(r)}}));var N=/[^\x20\t\r\n\f]+/g;function G(t){return t}function B(t){throw t}function F(t,e,n,i){var r;try{t&&g(r=t.promise)?r.call(t).done(e).fail(n):t&&g(r=t.then)?r.call(t,e,n):e.apply(void 0,[t].slice(i))}catch(t){n.apply(void 0,[t])}}x.Callbacks=function(t){t="string"==typeof t?function(t){var e={};return x.each(t.match(N)||[],(function(t,n){e[n]=!0})),e}(t):x.extend({},t);var e,n,i,r,o=[],s=[],a=-1,l=function(){for(r=r||t.once,i=e=!0;s.length;a=-1)for(n=s.shift();++a-1;)o.splice(n,1),n<=a&&a--})),this},has:function(t){return t?x.inArray(t,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return r=s=[],o=n="",this},disabled:function(){return!o},lock:function(){return r=s=[],n||e||(o=n=""),this},locked:function(){return!!r},fireWith:function(t,n){return r||(n=[t,(n=n||[]).slice?n.slice():n],s.push(n),e||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!i}};return c},x.extend({Deferred:function(t){var e=[["notify","progress",x.Callbacks("memory"),x.Callbacks("memory"),2],["resolve","done",x.Callbacks("once memory"),x.Callbacks("once memory"),0,"resolved"],["reject","fail",x.Callbacks("once memory"),x.Callbacks("once memory"),1,"rejected"]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},catch:function(t){return r.then(null,t)},pipe:function(){var t=arguments;return x.Deferred((function(n){x.each(e,(function(e,i){var r=g(t[i[4]])&&t[i[4]];o[i[1]]((function(){var t=r&&r.apply(this,arguments);t&&g(t.promise)?t.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[i[0]+"With"](this,r?[t]:arguments)}))})),t=null})).promise()},then:function(t,n,r){var o=0;function s(t,e,n,r){return function(){var a=this,l=arguments,c=function(){var i,c;if(!(t=o&&(n!==B&&(a=void 0,l=[i]),e.rejectWith(a,l))}};t?O():(x.Deferred.getErrorHook?O.error=x.Deferred.getErrorHook():x.Deferred.getStackHook&&(O.error=x.Deferred.getStackHook()),i.setTimeout(O))}}return x.Deferred((function(i){e[0][3].add(s(0,i,g(r)?r:G,i.notifyWith)),e[1][3].add(s(0,i,g(t)?t:G)),e[2][3].add(s(0,i,g(n)?n:B))})).promise()},promise:function(t){return null!=t?x.extend(t,r):r}},o={};return x.each(e,(function(t,i){var s=i[2],a=i[5];r[i[1]]=s.add,a&&s.add((function(){n=a}),e[3-t][2].disable,e[3-t][3].disable,e[0][2].lock,e[0][3].lock),s.add(i[3].fire),o[i[0]]=function(){return o[i[0]+"With"](this===o?void 0:this,arguments),this},o[i[0]+"With"]=s.fireWith})),r.promise(o),t&&t.call(o,o),o},when:function(t){var e=arguments.length,n=e,i=Array(n),r=a.call(arguments),o=x.Deferred(),s=function(t){return function(n){i[t]=this,r[t]=arguments.length>1?a.call(arguments):n,--e||o.resolveWith(i,r)}};if(e<=1&&(F(t,o.done(s(n)).resolve,o.reject,!e),"pending"===o.state()||g(r[n]&&r[n].then)))return o.then();for(;n--;)F(r[n],s(n),o.reject);return o.promise()}});var H=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;x.Deferred.exceptionHook=function(t,e){i.console&&i.console.warn&&t&&H.test(t.name)&&i.console.warn("jQuery.Deferred exception: "+t.message,t.stack,e)},x.readyException=function(t){i.setTimeout((function(){throw t}))};var K=x.Deferred();function J(){v.removeEventListener("DOMContentLoaded",J),i.removeEventListener("load",J),x.ready()}x.fn.ready=function(t){return K.then(t).catch((function(t){x.readyException(t)})),this},x.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--x.readyWait:x.isReady)||(x.isReady=!0,!0!==t&&--x.readyWait>0||K.resolveWith(v,[x]))}}),x.ready.then=K.then,"complete"===v.readyState||"loading"!==v.readyState&&!v.documentElement.doScroll?i.setTimeout(x.ready):(v.addEventListener("DOMContentLoaded",J),i.addEventListener("load",J));var tt=function(t,e,n,i,r,o,s){var a=0,l=t.length,c=null==n;if("object"===S(n))for(a in r=!0,n)tt(t,e,a,n[a],!0,o,s);else if(void 0!==i&&(r=!0,g(i)||(s=!0),c&&(s?(e.call(t,i),e=null):(c=e,e=function(t,e,n){return c.call(x(t),n)})),e))for(;a1,null,!0)},removeData:function(t){return this.each((function(){lt.remove(this,t)}))}}),x.extend({queue:function(t,e,n){var i;if(t)return e=(e||"fx")+"queue",i=at.get(t,e),n&&(!i||Array.isArray(n)?i=at.access(t,e,x.makeArray(n)):i.push(n)),i||[]},dequeue:function(t,e){e=e||"fx";var n=x.queue(t,e),i=n.length,r=n.shift(),o=x._queueHooks(t,e);"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===e&&n.unshift("inprogress"),delete o.stop,r.call(t,(function(){x.dequeue(t,e)}),o)),!i&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return at.get(t,n)||at.access(t,n,{empty:x.Callbacks("once memory").add((function(){at.remove(t,[e+"queue",n])}))})}}),x.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length\x20\t\r\n\f]*)/i,_t=/^$|^module$|\/(?:java|ecma)script/i;bt=v.createDocumentFragment().appendChild(v.createElement("div")),(wt=v.createElement("input")).setAttribute("type","radio"),wt.setAttribute("checked","checked"),wt.setAttribute("name","t"),bt.appendChild(wt),m.checkClone=bt.cloneNode(!0).cloneNode(!0).lastChild.checked,bt.innerHTML="",m.noCloneChecked=!!bt.cloneNode(!0).lastChild.defaultValue,bt.innerHTML="",m.option=!!bt.lastChild;var kt={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Tt(t,e){var n;return n=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&_(t,e)?x.merge([t],n):n}function Rt(t,e){for(var n=0,i=t.length;n",""]);var Xt=/<|&#?\w+;/;function zt(t,e,n,i,r){for(var o,s,a,l,c,O,h=e.createDocumentFragment(),u=[],d=0,f=t.length;d-1)r&&r.push(o);else if(c=mt(o),s=Tt(h.appendChild(o),"script"),c&&Rt(s),n)for(O=0;o=s[O++];)_t.test(o.type||"")&&n.push(o);return h}var Ct=/^([^.]*)(?:\.(.+)|)/;function qt(){return!0}function Et(){return!1}function Vt(t,e,n,i,r,o){var s,a;if("object"==typeof e){for(a in"string"!=typeof n&&(i=i||n,n=void 0),e)Vt(t,a,n,i,e[a],o);return t}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),!1===r)r=Et;else if(!r)return t;return 1===o&&(s=r,r=function(t){return x().off(t),s.apply(this,arguments)},r.guid=s.guid||(s.guid=x.guid++)),t.each((function(){x.event.add(this,e,r,i,n)}))}function Zt(t,e,n){n?(at.set(t,e,!1),x.event.add(t,e,{namespace:!1,handler:function(t){var n,i=at.get(this,e);if(1&t.isTrigger&&this[e]){if(i)(x.event.special[e]||{}).delegateType&&t.stopPropagation();else if(i=a.call(arguments),at.set(this,e,i),this[e](),n=at.get(this,e),at.set(this,e,!1),i!==n)return t.stopImmediatePropagation(),t.preventDefault(),n}else i&&(at.set(this,e,x.event.trigger(i[0],i.slice(1),this)),t.stopPropagation(),t.isImmediatePropagationStopped=qt)}})):void 0===at.get(t,e)&&x.event.add(t,e,qt)}x.event={global:{},add:function(t,e,n,i,r){var o,s,a,l,c,O,h,u,d,f,p,m=at.get(t);if(ot(t))for(n.handler&&(n=(o=n).handler,r=o.selector),r&&x.find.matchesSelector(pt,r),n.guid||(n.guid=x.guid++),(l=m.events)||(l=m.events=Object.create(null)),(s=m.handle)||(s=m.handle=function(e){return void 0!==x&&x.event.triggered!==e.type?x.event.dispatch.apply(t,arguments):void 0}),c=(e=(e||"").match(N)||[""]).length;c--;)d=p=(a=Ct.exec(e[c])||[])[1],f=(a[2]||"").split(".").sort(),d&&(h=x.event.special[d]||{},d=(r?h.delegateType:h.bindType)||d,h=x.event.special[d]||{},O=x.extend({type:d,origType:p,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&x.expr.match.needsContext.test(r),namespace:f.join(".")},o),(u=l[d])||((u=l[d]=[]).delegateCount=0,h.setup&&!1!==h.setup.call(t,i,f,s)||t.addEventListener&&t.addEventListener(d,s)),h.add&&(h.add.call(t,O),O.handler.guid||(O.handler.guid=n.guid)),r?u.splice(u.delegateCount++,0,O):u.push(O),x.event.global[d]=!0)},remove:function(t,e,n,i,r){var o,s,a,l,c,O,h,u,d,f,p,m=at.hasData(t)&&at.get(t);if(m&&(l=m.events)){for(c=(e=(e||"").match(N)||[""]).length;c--;)if(d=p=(a=Ct.exec(e[c])||[])[1],f=(a[2]||"").split(".").sort(),d){for(h=x.event.special[d]||{},u=l[d=(i?h.delegateType:h.bindType)||d]||[],a=a[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=u.length;o--;)O=u[o],!r&&p!==O.origType||n&&n.guid!==O.guid||a&&!a.test(O.namespace)||i&&i!==O.selector&&("**"!==i||!O.selector)||(u.splice(o,1),O.selector&&u.delegateCount--,h.remove&&h.remove.call(t,O));s&&!u.length&&(h.teardown&&!1!==h.teardown.call(t,f,m.handle)||x.removeEvent(t,d,m.handle),delete l[d])}else for(d in l)x.event.remove(t,d+e[c],n,i,!0);x.isEmptyObject(l)&&at.remove(t,"handle events")}},dispatch:function(t){var e,n,i,r,o,s,a=new Array(arguments.length),l=x.event.fix(t),c=(at.get(this,"events")||Object.create(null))[l.type]||[],O=x.event.special[l.type]||{};for(a[0]=l,e=1;e=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(o=[],s={},n=0;n-1:x.find(r,this,null,[c]).length),s[r]&&o.push(i);o.length&&a.push({elem:c,handlers:o})}return c=this,l\s*$/g;function Dt(t,e){return _(t,"table")&&_(11!==e.nodeType?e:e.firstChild,"tr")&&x(t).children("tbody")[0]||t}function Ut(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function Mt(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function jt(t,e){var n,i,r,o,s,a;if(1===e.nodeType){if(at.hasData(t)&&(a=at.get(t).events))for(r in at.remove(e,"handle events"),a)for(n=0,i=a[r].length;n1&&"string"==typeof f&&!m.checkClone&&Wt.test(f))return t.each((function(r){var o=t.eq(r);p&&(e[0]=f.call(this,r,o.html())),It(o,e,n,i)}));if(u&&(o=(r=zt(e,t[0].ownerDocument,!1,t,i)).firstChild,1===r.childNodes.length&&(r=o),o||i)){for(a=(s=x.map(Tt(r,"script"),Ut)).length;h0&&Rt(s,!l&&Tt(t,"script")),a},cleanData:function(t){for(var e,n,i,r=x.event.special,o=0;void 0!==(n=t[o]);o++)if(ot(n)){if(e=n[at.expando]){if(e.events)for(i in e.events)r[i]?x.event.remove(n,i):x.removeEvent(n,i,e.handle);n[at.expando]=void 0}n[lt.expando]&&(n[lt.expando]=void 0)}}}),x.fn.extend({detach:function(t){return Nt(this,t,!0)},remove:function(t){return Nt(this,t)},text:function(t){return tt(this,(function(t){return void 0===t?x.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)}))}),null,t,arguments.length)},append:function(){return It(this,arguments,(function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Dt(this,t).appendChild(t)}))},prepend:function(){return It(this,arguments,(function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=Dt(this,t);e.insertBefore(t,e.firstChild)}}))},before:function(){return It(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this)}))},after:function(){return It(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)}))},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(x.cleanData(Tt(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map((function(){return x.clone(this,t,e)}))},html:function(t){return tt(this,(function(t){var e=this[0]||{},n=0,i=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!At.test(t)&&!kt[(Pt.exec(t)||["",""])[1].toLowerCase()]){t=x.htmlPrefilter(t);try{for(;n=0&&(l+=Math.max(0,Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-o-l-a-.5))||0),l+c}function Oe(t,e,n){var i=Ft(t),r=(!m.boxSizingReliable()||n)&&"border-box"===x.css(t,"boxSizing",!1,i),o=r,s=Jt(t,e,i),a="offset"+e[0].toUpperCase()+e.slice(1);if(Gt.test(s)){if(!n)return s;s="auto"}return(!m.boxSizingReliable()&&r||!m.reliableTrDimensions()&&_(t,"tr")||"auto"===s||!parseFloat(s)&&"inline"===x.css(t,"display",!1,i))&&t.getClientRects().length&&(r="border-box"===x.css(t,"boxSizing",!1,i),(o=a in t)&&(s=t[a])),(s=parseFloat(s)||0)+ce(t,e,n||(r?"border":"content"),o,i,s)+"px"}function he(t,e,n,i,r){return new he.prototype.init(t,e,n,i,r)}x.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=Jt(t,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(t,e,n,i){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var r,o,s,a=rt(e),l=Bt.test(e),c=t.style;if(l||(e=re(a)),s=x.cssHooks[e]||x.cssHooks[a],void 0===n)return s&&"get"in s&&void 0!==(r=s.get(t,!1,i))?r:c[e];"string"===(o=typeof n)&&(r=dt.exec(n))&&r[1]&&(n=vt(t,e,r),o="number"),null!=n&&n==n&&("number"!==o||l||(n+=r&&r[3]||(x.cssNumber[a]?"":"px")),m.clearCloneStyle||""!==n||0!==e.indexOf("background")||(c[e]="inherit"),s&&"set"in s&&void 0===(n=s.set(t,n,i))||(l?c.setProperty(e,n):c[e]=n))}},css:function(t,e,n,i){var r,o,s,a=rt(e);return Bt.test(e)||(e=re(a)),(s=x.cssHooks[e]||x.cssHooks[a])&&"get"in s&&(r=s.get(t,!0,n)),void 0===r&&(r=Jt(t,e,i)),"normal"===r&&e in ae&&(r=ae[e]),""===n||n?(o=parseFloat(r),!0===n||isFinite(o)?o||0:r):r}}),x.each(["height","width"],(function(t,e){x.cssHooks[e]={get:function(t,n,i){if(n)return!oe.test(x.css(t,"display"))||t.getClientRects().length&&t.getBoundingClientRect().width?Oe(t,e,i):Ht(t,se,(function(){return Oe(t,e,i)}))},set:function(t,n,i){var r,o=Ft(t),s=!m.scrollboxSize()&&"absolute"===o.position,a=(s||i)&&"border-box"===x.css(t,"boxSizing",!1,o),l=i?ce(t,e,i,a,o):0;return a&&s&&(l-=Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-parseFloat(o[e])-ce(t,e,"border",!1,o)-.5)),l&&(r=dt.exec(n))&&"px"!==(r[3]||"px")&&(t.style[e]=n,n=x.css(t,e)),le(0,n,l)}}})),x.cssHooks.marginLeft=te(m.reliableMarginLeft,(function(t,e){if(e)return(parseFloat(Jt(t,"marginLeft"))||t.getBoundingClientRect().left-Ht(t,{marginLeft:0},(function(){return t.getBoundingClientRect().left})))+"px"})),x.each({margin:"",padding:"",border:"Width"},(function(t,e){x.cssHooks[t+e]={expand:function(n){for(var i=0,r={},o="string"==typeof n?n.split(" "):[n];i<4;i++)r[t+ft[i]+e]=o[i]||o[i-2]||o[0];return r}},"margin"!==t&&(x.cssHooks[t+e].set=le)})),x.fn.extend({css:function(t,e){return tt(this,(function(t,e,n){var i,r,o={},s=0;if(Array.isArray(e)){for(i=Ft(t),r=e.length;s1)}}),x.Tween=he,he.prototype={constructor:he,init:function(t,e,n,i,r,o){this.elem=t,this.prop=n,this.easing=r||x.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=i,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var t=he.propHooks[this.prop];return t&&t.get?t.get(this):he.propHooks._default.get(this)},run:function(t){var e,n=he.propHooks[this.prop];return this.options.duration?this.pos=e=x.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):he.propHooks._default.set(this),this}},he.prototype.init.prototype=he.prototype,he.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=x.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){x.fx.step[t.prop]?x.fx.step[t.prop](t):1!==t.elem.nodeType||!x.cssHooks[t.prop]&&null==t.elem.style[re(t.prop)]?t.elem[t.prop]=t.now:x.style(t.elem,t.prop,t.now+t.unit)}}},he.propHooks.scrollTop=he.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},x.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},x.fx=he.prototype.init,x.fx.step={};var ue,de,fe=/^(?:toggle|show|hide)$/,pe=/queueHooks$/;function me(){de&&(!1===v.hidden&&i.requestAnimationFrame?i.requestAnimationFrame(me):i.setTimeout(me,x.fx.interval),x.fx.tick())}function ge(){return i.setTimeout((function(){ue=void 0})),ue=Date.now()}function ye(t,e){var n,i=0,r={height:t};for(e=e?1:0;i<4;i+=2-e)r["margin"+(n=ft[i])]=r["padding"+n]=t;return e&&(r.opacity=r.width=t),r}function ve(t,e,n){for(var i,r=($e.tweeners[e]||[]).concat($e.tweeners["*"]),o=0,s=r.length;o1)},removeAttr:function(t){return this.each((function(){x.removeAttr(this,t)}))}}),x.extend({attr:function(t,e,n){var i,r,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===t.getAttribute?x.prop(t,e,n):(1===o&&x.isXMLDoc(t)||(r=x.attrHooks[e.toLowerCase()]||(x.expr.match.bool.test(e)?Qe:void 0)),void 0!==n?null===n?void x.removeAttr(t,e):r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:(t.setAttribute(e,n+""),n):r&&"get"in r&&null!==(i=r.get(t,e))?i:null==(i=x.find.attr(t,e))?void 0:i)},attrHooks:{type:{set:function(t,e){if(!m.radioValue&&"radio"===e&&_(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,i=0,r=e&&e.match(N);if(r&&1===t.nodeType)for(;n=r[i++];)t.removeAttribute(n)}}),Qe={set:function(t,e,n){return!1===e?x.removeAttr(t,n):t.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),(function(t,e){var n=Se[e]||x.find.attr;Se[e]=function(t,e,i){var r,o,s=e.toLowerCase();return i||(o=Se[s],Se[s]=r,r=null!=n(t,e,i)?s:null,Se[s]=o),r}}));var be=/^(?:input|select|textarea|button)$/i,we=/^(?:a|area)$/i;function xe(t){return(t.match(N)||[]).join(" ")}function Pe(t){return t.getAttribute&&t.getAttribute("class")||""}function _e(t){return Array.isArray(t)?t:"string"==typeof t&&t.match(N)||[]}x.fn.extend({prop:function(t,e){return tt(this,x.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each((function(){delete this[x.propFix[t]||t]}))}}),x.extend({prop:function(t,e,n){var i,r,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&x.isXMLDoc(t)||(e=x.propFix[e]||e,r=x.propHooks[e]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:t[e]=n:r&&"get"in r&&null!==(i=r.get(t,e))?i:t[e]},propHooks:{tabIndex:{get:function(t){var e=x.find.attr(t,"tabindex");return e?parseInt(e,10):be.test(t.nodeName)||we.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),m.optSelected||(x.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){x.propFix[this.toLowerCase()]=this})),x.fn.extend({addClass:function(t){var e,n,i,r,o,s;return g(t)?this.each((function(e){x(this).addClass(t.call(this,e,Pe(this)))})):(e=_e(t)).length?this.each((function(){if(i=Pe(this),n=1===this.nodeType&&" "+xe(i)+" "){for(o=0;o-1;)n=n.replace(" "+r+" "," ");s=xe(n),i!==s&&this.setAttribute("class",s)}})):this:this.attr("class","")},toggleClass:function(t,e){var n,i,r,o,s=typeof t,a="string"===s||Array.isArray(t);return g(t)?this.each((function(n){x(this).toggleClass(t.call(this,n,Pe(this),e),e)})):"boolean"==typeof e&&a?e?this.addClass(t):this.removeClass(t):(n=_e(t),this.each((function(){if(a)for(o=x(this),r=0;r-1)return!0;return!1}});var ke=/\r/g;x.fn.extend({val:function(t){var e,n,i,r=this[0];return arguments.length?(i=g(t),this.each((function(n){var r;1===this.nodeType&&(null==(r=i?t.call(this,n,x(this).val()):t)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=x.map(r,(function(t){return null==t?"":t+""}))),(e=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,r,"value")||(this.value=r))}))):r?(e=x.valHooks[r.type]||x.valHooks[r.nodeName.toLowerCase()])&&"get"in e&&void 0!==(n=e.get(r,"value"))?n:"string"==typeof(n=r.value)?n.replace(ke,""):null==n?"":n:void 0}}),x.extend({valHooks:{option:{get:function(t){var e=x.find.attr(t,"value");return null!=e?e:xe(x.text(t))}},select:{get:function(t){var e,n,i,r=t.options,o=t.selectedIndex,s="select-one"===t.type,a=s?null:[],l=s?o+1:r.length;for(i=o<0?l:s?o:0;i-1)&&(n=!0);return n||(t.selectedIndex=-1),o}}}}),x.each(["radio","checkbox"],(function(){x.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=x.inArray(x(t).val(),e)>-1}},m.checkOn||(x.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})}));var Te=i.location,Re={guid:Date.now()},Xe=/\?/;x.parseXML=function(t){var e,n;if(!t||"string"!=typeof t)return null;try{e=(new i.DOMParser).parseFromString(t,"text/xml")}catch(t){}return n=e&&e.getElementsByTagName("parsererror")[0],e&&!n||x.error("Invalid XML: "+(n?x.map(n.childNodes,(function(t){return t.textContent})).join("\n"):t)),e};var ze=/^(?:focusinfocus|focusoutblur)$/,Ce=function(t){t.stopPropagation()};x.extend(x.event,{trigger:function(t,e,n,r){var o,s,a,l,c,O,h,u,f=[n||v],p=d.call(t,"type")?t.type:t,m=d.call(t,"namespace")?t.namespace.split("."):[];if(s=u=a=n=n||v,3!==n.nodeType&&8!==n.nodeType&&!ze.test(p+x.event.triggered)&&(p.indexOf(".")>-1&&(m=p.split("."),p=m.shift(),m.sort()),c=p.indexOf(":")<0&&"on"+p,(t=t[x.expando]?t:new x.Event(p,"object"==typeof t&&t)).isTrigger=r?2:3,t.namespace=m.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=n),e=null==e?[t]:x.makeArray(e,[t]),h=x.event.special[p]||{},r||!h.trigger||!1!==h.trigger.apply(n,e))){if(!r&&!h.noBubble&&!y(n)){for(l=h.delegateType||p,ze.test(l+p)||(s=s.parentNode);s;s=s.parentNode)f.push(s),a=s;a===(n.ownerDocument||v)&&f.push(a.defaultView||a.parentWindow||i)}for(o=0;(s=f[o++])&&!t.isPropagationStopped();)u=s,t.type=o>1?l:h.bindType||p,(O=(at.get(s,"events")||Object.create(null))[t.type]&&at.get(s,"handle"))&&O.apply(s,e),(O=c&&s[c])&&O.apply&&ot(s)&&(t.result=O.apply(s,e),!1===t.result&&t.preventDefault());return t.type=p,r||t.isDefaultPrevented()||h._default&&!1!==h._default.apply(f.pop(),e)||!ot(n)||c&&g(n[p])&&!y(n)&&((a=n[c])&&(n[c]=null),x.event.triggered=p,t.isPropagationStopped()&&u.addEventListener(p,Ce),n[p](),t.isPropagationStopped()&&u.removeEventListener(p,Ce),x.event.triggered=void 0,a&&(n[c]=a)),t.result}},simulate:function(t,e,n){var i=x.extend(new x.Event,n,{type:t,isSimulated:!0});x.event.trigger(i,null,e)}}),x.fn.extend({trigger:function(t,e){return this.each((function(){x.event.trigger(t,e,this)}))},triggerHandler:function(t,e){var n=this[0];if(n)return x.event.trigger(t,e,n,!0)}});var qe=/\[\]$/,Ee=/\r?\n/g,Ve=/^(?:submit|button|image|reset|file)$/i,Ze=/^(?:input|select|textarea|keygen)/i;function Ae(t,e,n,i){var r;if(Array.isArray(e))x.each(e,(function(e,r){n||qe.test(t)?i(t,r):Ae(t+"["+("object"==typeof r&&null!=r?e:"")+"]",r,n,i)}));else if(n||"object"!==S(e))i(t,e);else for(r in e)Ae(t+"["+r+"]",e[r],n,i)}x.param=function(t,e){var n,i=[],r=function(t,e){var n=g(e)?e():e;i[i.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!x.isPlainObject(t))x.each(t,(function(){r(this.name,this.value)}));else for(n in t)Ae(n,t[n],e,r);return i.join("&")},x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var t=x.prop(this,"elements");return t?x.makeArray(t):this})).filter((function(){var t=this.type;return this.name&&!x(this).is(":disabled")&&Ze.test(this.nodeName)&&!Ve.test(t)&&(this.checked||!xt.test(t))})).map((function(t,e){var n=x(this).val();return null==n?null:Array.isArray(n)?x.map(n,(function(t){return{name:e.name,value:t.replace(Ee,"\r\n")}})):{name:e.name,value:n.replace(Ee,"\r\n")}})).get()}});var We=/%20/g,Ye=/#.*$/,De=/([?&])_=[^&]*/,Ue=/^(.*?):[ \t]*([^\r\n]*)$/gm,Me=/^(?:GET|HEAD)$/,je=/^\/\//,Le={},Ie={},Ne="*/".concat("*"),Ge=v.createElement("a");function Be(t){return function(e,n){"string"!=typeof e&&(n=e,e="*");var i,r=0,o=e.toLowerCase().match(N)||[];if(g(n))for(;i=o[r++];)"+"===i[0]?(i=i.slice(1)||"*",(t[i]=t[i]||[]).unshift(n)):(t[i]=t[i]||[]).push(n)}}function Fe(t,e,n,i){var r={},o=t===Ie;function s(a){var l;return r[a]=!0,x.each(t[a]||[],(function(t,a){var c=a(e,n,i);return"string"!=typeof c||o||r[c]?o?!(l=c):void 0:(e.dataTypes.unshift(c),s(c),!1)})),l}return s(e.dataTypes[0])||!r["*"]&&s("*")}function He(t,e){var n,i,r=x.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((r[n]?t:i||(i={}))[n]=e[n]);return i&&x.extend(!0,t,i),t}Ge.href=Te.href,x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Te.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Te.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ne,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?He(He(t,x.ajaxSettings),e):He(x.ajaxSettings,t)},ajaxPrefilter:Be(Le),ajaxTransport:Be(Ie),ajax:function(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,r,o,s,a,l,c,O,h,u,d=x.ajaxSetup({},e),f=d.context||d,p=d.context&&(f.nodeType||f.jquery)?x(f):x.event,m=x.Deferred(),g=x.Callbacks("once memory"),y=d.statusCode||{},$={},Q={},S="canceled",b={readyState:0,getResponseHeader:function(t){var e;if(c){if(!s)for(s={};e=Ue.exec(o);)s[e[1].toLowerCase()+" "]=(s[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=s[t.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return c?o:null},setRequestHeader:function(t,e){return null==c&&(t=Q[t.toLowerCase()]=Q[t.toLowerCase()]||t,$[t]=e),this},overrideMimeType:function(t){return null==c&&(d.mimeType=t),this},statusCode:function(t){var e;if(t)if(c)b.always(t[b.status]);else for(e in t)y[e]=[y[e],t[e]];return this},abort:function(t){var e=t||S;return n&&n.abort(e),w(0,e),this}};if(m.promise(b),d.url=((t||d.url||Te.href)+"").replace(je,Te.protocol+"//"),d.type=e.method||e.type||d.method||d.type,d.dataTypes=(d.dataType||"*").toLowerCase().match(N)||[""],null==d.crossDomain){l=v.createElement("a");try{l.href=d.url,l.href=l.href,d.crossDomain=Ge.protocol+"//"+Ge.host!=l.protocol+"//"+l.host}catch(t){d.crossDomain=!0}}if(d.data&&d.processData&&"string"!=typeof d.data&&(d.data=x.param(d.data,d.traditional)),Fe(Le,d,e,b),c)return b;for(h in(O=x.event&&d.global)&&0==x.active++&&x.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Me.test(d.type),r=d.url.replace(Ye,""),d.hasContent?d.data&&d.processData&&0===(d.contentType||"").indexOf("application/x-www-form-urlencoded")&&(d.data=d.data.replace(We,"+")):(u=d.url.slice(r.length),d.data&&(d.processData||"string"==typeof d.data)&&(r+=(Xe.test(r)?"&":"?")+d.data,delete d.data),!1===d.cache&&(r=r.replace(De,"$1"),u=(Xe.test(r)?"&":"?")+"_="+Re.guid+++u),d.url=r+u),d.ifModified&&(x.lastModified[r]&&b.setRequestHeader("If-Modified-Since",x.lastModified[r]),x.etag[r]&&b.setRequestHeader("If-None-Match",x.etag[r])),(d.data&&d.hasContent&&!1!==d.contentType||e.contentType)&&b.setRequestHeader("Content-Type",d.contentType),b.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Ne+"; q=0.01":""):d.accepts["*"]),d.headers)b.setRequestHeader(h,d.headers[h]);if(d.beforeSend&&(!1===d.beforeSend.call(f,b,d)||c))return b.abort();if(S="abort",g.add(d.complete),b.done(d.success),b.fail(d.error),n=Fe(Ie,d,e,b)){if(b.readyState=1,O&&p.trigger("ajaxSend",[b,d]),c)return b;d.async&&d.timeout>0&&(a=i.setTimeout((function(){b.abort("timeout")}),d.timeout));try{c=!1,n.send($,w)}catch(t){if(c)throw t;w(-1,t)}}else w(-1,"No Transport");function w(t,e,s,l){var h,u,v,$,Q,S=e;c||(c=!0,a&&i.clearTimeout(a),n=void 0,o=l||"",b.readyState=t>0?4:0,h=t>=200&&t<300||304===t,s&&($=function(t,e,n){for(var i,r,o,s,a=t.contents,l=t.dataTypes;"*"===l[0];)l.shift(),void 0===i&&(i=t.mimeType||e.getResponseHeader("Content-Type"));if(i)for(r in a)if(a[r]&&a[r].test(i)){l.unshift(r);break}if(l[0]in n)o=l[0];else{for(r in n){if(!l[0]||t.converters[r+" "+l[0]]){o=r;break}s||(s=r)}o=o||s}if(o)return o!==l[0]&&l.unshift(o),n[o]}(d,b,s)),!h&&x.inArray("script",d.dataTypes)>-1&&x.inArray("json",d.dataTypes)<0&&(d.converters["text script"]=function(){}),$=function(t,e,n,i){var r,o,s,a,l,c={},O=t.dataTypes.slice();if(O[1])for(s in t.converters)c[s.toLowerCase()]=t.converters[s];for(o=O.shift();o;)if(t.responseFields[o]&&(n[t.responseFields[o]]=e),!l&&i&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=o,o=O.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(!(s=c[l+" "+o]||c["* "+o]))for(r in c)if((a=r.split(" "))[1]===o&&(s=c[l+" "+a[0]]||c["* "+a[0]])){!0===s?s=c[r]:!0!==c[r]&&(o=a[0],O.unshift(a[1]));break}if(!0!==s)if(s&&t.throws)e=s(e);else try{e=s(e)}catch(t){return{state:"parsererror",error:s?t:"No conversion from "+l+" to "+o}}}return{state:"success",data:e}}(d,$,b,h),h?(d.ifModified&&((Q=b.getResponseHeader("Last-Modified"))&&(x.lastModified[r]=Q),(Q=b.getResponseHeader("etag"))&&(x.etag[r]=Q)),204===t||"HEAD"===d.type?S="nocontent":304===t?S="notmodified":(S=$.state,u=$.data,h=!(v=$.error))):(v=S,!t&&S||(S="error",t<0&&(t=0))),b.status=t,b.statusText=(e||S)+"",h?m.resolveWith(f,[u,S,b]):m.rejectWith(f,[b,S,v]),b.statusCode(y),y=void 0,O&&p.trigger(h?"ajaxSuccess":"ajaxError",[b,d,h?u:v]),g.fireWith(f,[b,S]),O&&(p.trigger("ajaxComplete",[b,d]),--x.active||x.event.trigger("ajaxStop")))}return b},getJSON:function(t,e,n){return x.get(t,e,n,"json")},getScript:function(t,e){return x.get(t,void 0,e,"script")}}),x.each(["get","post"],(function(t,e){x[e]=function(t,n,i,r){return g(n)&&(r=r||i,i=n,n=void 0),x.ajax(x.extend({url:t,type:e,dataType:r,data:n,success:i},x.isPlainObject(t)&&t))}})),x.ajaxPrefilter((function(t){var e;for(e in t.headers)"content-type"===e.toLowerCase()&&(t.contentType=t.headers[e]||"")})),x._evalUrl=function(t,e,n){return x.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(t){x.globalEval(t,e,n)}})},x.fn.extend({wrapAll:function(t){var e;return this[0]&&(g(t)&&(t=t.call(this[0])),e=x(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map((function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t})).append(this)),this},wrapInner:function(t){return g(t)?this.each((function(e){x(this).wrapInner(t.call(this,e))})):this.each((function(){var e=x(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)}))},wrap:function(t){var e=g(t);return this.each((function(n){x(this).wrapAll(e?t.call(this,n):t)}))},unwrap:function(t){return this.parent(t).not("body").each((function(){x(this).replaceWith(this.childNodes)})),this}}),x.expr.pseudos.hidden=function(t){return!x.expr.pseudos.visible(t)},x.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},x.ajaxSettings.xhr=function(){try{return new i.XMLHttpRequest}catch(t){}};var Ke={0:200,1223:204},Je=x.ajaxSettings.xhr();m.cors=!!Je&&"withCredentials"in Je,m.ajax=Je=!!Je,x.ajaxTransport((function(t){var e,n;if(m.cors||Je&&!t.crossDomain)return{send:function(r,o){var s,a=t.xhr();if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(s in t.xhrFields)a[s]=t.xhrFields[s];for(s in t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(s,r[s]);e=function(t){return function(){e&&(e=n=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===t?a.abort():"error"===t?"number"!=typeof a.status?o(0,"error"):o(a.status,a.statusText):o(Ke[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=e(),n=a.onerror=a.ontimeout=e("error"),void 0!==a.onabort?a.onabort=n:a.onreadystatechange=function(){4===a.readyState&&i.setTimeout((function(){e&&n()}))},e=e("abort");try{a.send(t.hasContent&&t.data||null)}catch(t){if(e)throw t}},abort:function(){e&&e()}}})),x.ajaxPrefilter((function(t){t.crossDomain&&(t.contents.script=!1)})),x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return x.globalEval(t),t}}}),x.ajaxPrefilter("script",(function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")})),x.ajaxTransport("script",(function(t){var e,n;if(t.crossDomain||t.scriptAttrs)return{send:function(i,r){e=x(" +{{-- --}} '; - }; - var dataToHtml = function (editor, dataIn) { - var data = global$1.extend({}, dataIn); - if (!data.source) { - global$1.extend(data, htmlToData(getScripts(editor), data.embed)); - if (!data.source) { - return ''; - } - } - if (!data.altsource) { - data.altsource = ''; - } - if (!data.poster) { - data.poster = ''; - } - data.source = editor.convertURL(data.source, 'source'); - data.altsource = editor.convertURL(data.altsource, 'source'); - data.sourcemime = guess(data.source); - data.altsourcemime = guess(data.altsource); - data.poster = editor.convertURL(data.poster, 'poster'); - var pattern = matchPattern(data.source); - if (pattern) { - data.source = pattern.url; - data.type = pattern.type; - data.allowfullscreen = pattern.allowFullscreen; - data.width = data.width || String(pattern.w); - data.height = data.height || String(pattern.h); - } - if (data.embed) { - return updateHtml(data.embed, data, true); - } else { - var videoScript = getVideoScriptMatch(getScripts(editor), data.source); - if (videoScript) { - data.type = 'script'; - data.width = String(videoScript.width); - data.height = String(videoScript.height); - } - var audioTemplateCallback = getAudioTemplateCallback(editor); - var videoTemplateCallback = getVideoTemplateCallback(editor); - data.width = data.width || '300'; - data.height = data.height || '150'; - global$1.each(data, function (value, key) { - data[key] = editor.dom.encode('' + value); - }); - if (data.type === 'iframe') { - return getIframeHtml(data); - } else if (data.sourcemime === 'application/x-shockwave-flash') { - return getFlashHtml(data); - } else if (data.sourcemime.indexOf('audio') !== -1) { - return getAudioHtml(data, audioTemplateCallback); - } else if (data.type === 'script') { - return getScriptHtml(data); - } else { - return getVideoHtml(data, videoTemplateCallback); - } - } - }; - - var global$6 = tinymce.util.Tools.resolve('tinymce.util.Promise'); - - var cache = {}; - var embedPromise = function (data, dataToHtml, handler) { - return new global$6(function (res, rej) { - var wrappedResolve = function (response) { - if (response.html) { - cache[data.source] = response; - } - return res({ - url: data.source, - html: response.html ? response.html : dataToHtml(data) - }); - }; - if (cache[data.source]) { - wrappedResolve(cache[data.source]); - } else { - handler({ url: data.source }, wrappedResolve, rej); - } - }); - }; - var defaultPromise = function (data, dataToHtml) { - return new global$6(function (res) { - res({ - html: dataToHtml(data), - url: data.source - }); - }); - }; - var loadedData = function (editor) { - return function (data) { - return dataToHtml(editor, data); - }; - }; - var getEmbedHtml = function (editor, data) { - var embedHandler = getUrlResolver(editor); - return embedHandler ? embedPromise(data, loadedData(editor), embedHandler) : defaultPromise(data, loadedData(editor)); - }; - var isCached = function (url) { - return cache.hasOwnProperty(url); - }; - - var extractMeta = function (sourceInput, data) { - return get(data, sourceInput).bind(function (mainData) { - return get(mainData, 'meta'); - }); - }; - var getValue = function (data, metaData, sourceInput) { - return function (prop) { - var _a; - var getFromData = function () { - return get(data, prop); - }; - var getFromMetaData = function () { - return get(metaData, prop); - }; - var getNonEmptyValue = function (c) { - return get(c, 'value').bind(function (v) { - return v.length > 0 ? Optional.some(v) : Optional.none(); - }); - }; - var getFromValueFirst = function () { - return getFromData().bind(function (child) { - return isObject(child) ? getNonEmptyValue(child).orThunk(getFromMetaData) : getFromMetaData().orThunk(function () { - return Optional.from(child); - }); - }); - }; - var getFromMetaFirst = function () { - return getFromMetaData().orThunk(function () { - return getFromData().bind(function (child) { - return isObject(child) ? getNonEmptyValue(child) : Optional.from(child); - }); - }); - }; - return _a = {}, _a[prop] = (prop === sourceInput ? getFromValueFirst() : getFromMetaFirst()).getOr(''), _a; - }; - }; - var getDimensions = function (data, metaData) { - var dimensions = {}; - get(data, 'dimensions').each(function (dims) { - each([ - 'width', - 'height' - ], function (prop) { - get(metaData, prop).orThunk(function () { - return get(dims, prop); - }).each(function (value) { - return dimensions[prop] = value; - }); - }); - }); - return dimensions; - }; - var unwrap = function (data, sourceInput) { - var metaData = sourceInput ? extractMeta(sourceInput, data).getOr({}) : {}; - var get = getValue(data, metaData, sourceInput); - return __assign(__assign(__assign(__assign(__assign({}, get('source')), get('altsource')), get('poster')), get('embed')), getDimensions(data, metaData)); - }; - var wrap = function (data) { - var wrapped = __assign(__assign({}, data), { - source: { value: get(data, 'source').getOr('') }, - altsource: { value: get(data, 'altsource').getOr('') }, - poster: { value: get(data, 'poster').getOr('') } - }); - each([ - 'width', - 'height' - ], function (prop) { - get(data, prop).each(function (value) { - var dimensions = wrapped.dimensions || {}; - dimensions[prop] = value; - wrapped.dimensions = dimensions; - }); - }); - return wrapped; - }; - var handleError = function (editor) { - return function (error) { - var errorMessage = error && error.msg ? 'Media embed handler error: ' + error.msg : 'Media embed handler threw unknown error.'; - editor.notificationManager.open({ - type: 'error', - text: errorMessage - }); - }; - }; - var snippetToData = function (editor, embedSnippet) { - return htmlToData(getScripts(editor), embedSnippet); - }; - var isMediaElement = function (element) { - return element.getAttribute('data-mce-object') || element.getAttribute('data-ephox-embed-iri'); - }; - var getEditorData = function (editor) { - var element = editor.selection.getNode(); - var snippet = isMediaElement(element) ? editor.serializer.serialize(element, { selection: true }) : ''; - return __assign({ embed: snippet }, htmlToData(getScripts(editor), snippet)); - }; - var addEmbedHtml = function (api, editor) { - return function (response) { - if (isString(response.url) && response.url.trim().length > 0) { - var html = response.html; - var snippetData = snippetToData(editor, html); - var nuData = __assign(__assign({}, snippetData), { - source: response.url, - embed: html - }); - api.setData(wrap(nuData)); - } - }; - }; - var selectPlaceholder = function (editor, beforeObjects) { - var afterObjects = editor.dom.select('*[data-mce-object]'); - for (var i = 0; i < beforeObjects.length; i++) { - for (var y = afterObjects.length - 1; y >= 0; y--) { - if (beforeObjects[i] === afterObjects[y]) { - afterObjects.splice(y, 1); - } - } - } - editor.selection.select(afterObjects[0]); - }; - var handleInsert = function (editor, html) { - var beforeObjects = editor.dom.select('*[data-mce-object]'); - editor.insertContent(html); - selectPlaceholder(editor, beforeObjects); - editor.nodeChanged(); - }; - var submitForm = function (prevData, newData, editor) { - newData.embed = updateHtml(newData.embed, newData); - if (newData.embed && (prevData.source === newData.source || isCached(newData.source))) { - handleInsert(editor, newData.embed); - } else { - getEmbedHtml(editor, newData).then(function (response) { - handleInsert(editor, response.html); - }).catch(handleError(editor)); - } - }; - var showDialog = function (editor) { - var editorData = getEditorData(editor); - var currentData = Cell(editorData); - var initialData = wrap(editorData); - var handleSource = function (prevData, api) { - var serviceData = unwrap(api.getData(), 'source'); - if (prevData.source !== serviceData.source) { - addEmbedHtml(win, editor)({ - url: serviceData.source, - html: '' - }); - getEmbedHtml(editor, serviceData).then(addEmbedHtml(win, editor)).catch(handleError(editor)); - } - }; - var handleEmbed = function (api) { - var data = unwrap(api.getData()); - var dataFromEmbed = snippetToData(editor, data.embed); - api.setData(wrap(dataFromEmbed)); - }; - var handleUpdate = function (api, sourceInput) { - var data = unwrap(api.getData(), sourceInput); - var embed = dataToHtml(editor, data); - api.setData(wrap(__assign(__assign({}, data), { embed: embed }))); - }; - var mediaInput = [{ - name: 'source', - type: 'urlinput', - filetype: 'media', - label: 'Source' - }]; - var sizeInput = !hasDimensions(editor) ? [] : [{ - type: 'sizeinput', - name: 'dimensions', - label: 'Constrain proportions', - constrain: true - }]; - var generalTab = { - title: 'General', - name: 'general', - items: flatten([ - mediaInput, - sizeInput - ]) - }; - var embedTextarea = { - type: 'textarea', - name: 'embed', - label: 'Paste your embed code below:' - }; - var embedTab = { - title: 'Embed', - items: [embedTextarea] - }; - var advancedFormItems = []; - if (hasAltSource(editor)) { - advancedFormItems.push({ - name: 'altsource', - type: 'urlinput', - filetype: 'media', - label: 'Alternative source URL' - }); - } - if (hasPoster(editor)) { - advancedFormItems.push({ - name: 'poster', - type: 'urlinput', - filetype: 'image', - label: 'Media poster (Image URL)' - }); - } - var advancedTab = { - title: 'Advanced', - name: 'advanced', - items: advancedFormItems - }; - var tabs = [ - generalTab, - embedTab - ]; - if (advancedFormItems.length > 0) { - tabs.push(advancedTab); - } - var body = { - type: 'tabpanel', - tabs: tabs - }; - var win = editor.windowManager.open({ - title: 'Insert/Edit Media', - size: 'normal', - body: body, - buttons: [ - { - type: 'cancel', - name: 'cancel', - text: 'Cancel' - }, - { - type: 'submit', - name: 'save', - text: 'Save', - primary: true - } - ], - onSubmit: function (api) { - var serviceData = unwrap(api.getData()); - submitForm(currentData.get(), serviceData, editor); - api.close(); - }, - onChange: function (api, detail) { - switch (detail.name) { - case 'source': - handleSource(currentData.get(), api); - break; - case 'embed': - handleEmbed(api); - break; - case 'dimensions': - case 'altsource': - case 'poster': - handleUpdate(api, detail.name); - break; - } - currentData.set(unwrap(api.getData())); - }, - initialData: initialData - }); - }; - - var get$1 = function (editor) { - var showDialog$1 = function () { - showDialog(editor); - }; - return { showDialog: showDialog$1 }; - }; - - var register = function (editor) { - var showDialog$1 = function () { - showDialog(editor); - }; - editor.addCommand('mceMedia', showDialog$1); - }; - - var global$7 = tinymce.util.Tools.resolve('tinymce.html.Node'); - - var global$8 = tinymce.util.Tools.resolve('tinymce.Env'); - - var global$9 = tinymce.util.Tools.resolve('tinymce.html.DomParser'); - - var sanitize = function (editor, html) { - if (shouldFilterHtml(editor) === false) { - return html; - } - var writer = global$5(); - var blocked; - global$3({ - validate: false, - allow_conditional_comments: false, - comment: function (text) { - if (!blocked) { - writer.comment(text); - } - }, - cdata: function (text) { - if (!blocked) { - writer.cdata(text); - } - }, - text: function (text, raw) { - if (!blocked) { - writer.text(text, raw); - } - }, - start: function (name, attrs, empty) { - blocked = true; - if (name === 'script' || name === 'noscript' || name === 'svg') { - return; - } - for (var i = attrs.length - 1; i >= 0; i--) { - var attrName = attrs[i].name; - if (attrName.indexOf('on') === 0) { - delete attrs.map[attrName]; - attrs.splice(i, 1); - } - if (attrName === 'style') { - attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name); - } - } - writer.start(name, attrs, empty); - blocked = false; - }, - end: function (name) { - if (blocked) { - return; - } - writer.end(name); - } - }, global$4({})).parse(html); - return writer.getContent(); - }; - - var isLiveEmbedNode = function (node) { - var name = node.name; - return name === 'iframe' || name === 'video' || name === 'audio'; - }; - var getDimension = function (node, styles, dimension, defaultValue) { - if (defaultValue === void 0) { - defaultValue = null; - } - var value = node.attr(dimension); - if (isNonNullable(value)) { - return value; - } else if (!has(styles, dimension)) { - return defaultValue; - } else { - return null; - } - }; - var setDimensions = function (node, previewNode, styles) { - var useDefaults = previewNode.name === 'img' || node.name === 'video'; - var defaultWidth = useDefaults ? '300' : null; - var fallbackHeight = node.name === 'audio' ? '30' : '150'; - var defaultHeight = useDefaults ? fallbackHeight : null; - previewNode.attr({ - width: getDimension(node, styles, 'width', defaultWidth), - height: getDimension(node, styles, 'height', defaultHeight) - }); - }; - var appendNodeContent = function (editor, nodeName, previewNode, html) { - var newNode = global$9({ - forced_root_block: false, - validate: false - }, editor.schema).parse(html, { context: nodeName }); - while (newNode.firstChild) { - previewNode.append(newNode.firstChild); - } - }; - var createPlaceholderNode = function (editor, node) { - var name = node.name; - var placeHolder = new global$7('img', 1); - placeHolder.shortEnded = true; - retainAttributesAndInnerHtml(editor, node, placeHolder); - setDimensions(node, placeHolder, {}); - placeHolder.attr({ - 'style': node.attr('style'), - 'src': global$8.transparentSrc, - 'data-mce-object': name, - 'class': 'mce-object mce-object-' + name - }); - return placeHolder; - }; - var createPreviewNode = function (editor, node) { - var name = node.name; - var previewWrapper = new global$7('span', 1); - previewWrapper.attr({ - 'contentEditable': 'false', - 'style': node.attr('style'), - 'data-mce-object': name, - 'class': 'mce-preview-object mce-object-' + name - }); - retainAttributesAndInnerHtml(editor, node, previewWrapper); - var styles = editor.dom.parseStyle(node.attr('style')); - var previewNode = new global$7(name, 1); - setDimensions(node, previewNode, styles); - previewNode.attr({ - src: node.attr('src'), - style: node.attr('style'), - class: node.attr('class') - }); - if (name === 'iframe') { - previewNode.attr({ - allowfullscreen: node.attr('allowfullscreen'), - frameborder: '0' - }); - } else { - var attrs = [ - 'controls', - 'crossorigin', - 'currentTime', - 'loop', - 'muted', - 'poster', - 'preload' - ]; - each(attrs, function (attrName) { - previewNode.attr(attrName, node.attr(attrName)); - }); - var sanitizedHtml = previewWrapper.attr('data-mce-html'); - if (isNonNullable(sanitizedHtml)) { - appendNodeContent(editor, name, previewNode, sanitizedHtml); - } - } - var shimNode = new global$7('span', 1); - shimNode.attr('class', 'mce-shim'); - previewWrapper.append(previewNode); - previewWrapper.append(shimNode); - return previewWrapper; - }; - var retainAttributesAndInnerHtml = function (editor, sourceNode, targetNode) { - var attribs = sourceNode.attributes; - var ai = attribs.length; - while (ai--) { - var attrName = attribs[ai].name; - var attrValue = attribs[ai].value; - if (attrName !== 'width' && attrName !== 'height' && attrName !== 'style') { - if (attrName === 'data' || attrName === 'src') { - attrValue = editor.convertURL(attrValue, attrName); - } - targetNode.attr('data-mce-p-' + attrName, attrValue); - } - } - var innerHtml = sourceNode.firstChild && sourceNode.firstChild.value; - if (innerHtml) { - targetNode.attr('data-mce-html', escape(sanitize(editor, innerHtml))); - targetNode.firstChild = null; - } - }; - var isPageEmbedWrapper = function (node) { - var nodeClass = node.attr('class'); - return nodeClass && /\btiny-pageembed\b/.test(nodeClass); - }; - var isWithinEmbedWrapper = function (node) { - while (node = node.parent) { - if (node.attr('data-ephox-embed-iri') || isPageEmbedWrapper(node)) { - return true; - } - } - return false; - }; - var placeHolderConverter = function (editor) { - return function (nodes) { - var i = nodes.length; - var node; - var videoScript; - while (i--) { - node = nodes[i]; - if (!node.parent) { - continue; - } - if (node.parent.attr('data-mce-object')) { - continue; - } - if (node.name === 'script') { - videoScript = getVideoScriptMatch(getScripts(editor), node.attr('src')); - if (!videoScript) { - continue; - } - } - if (videoScript) { - if (videoScript.width) { - node.attr('width', videoScript.width.toString()); - } - if (videoScript.height) { - node.attr('height', videoScript.height.toString()); - } - } - if (isLiveEmbedNode(node) && hasLiveEmbeds(editor) && global$8.ceFalse) { - if (!isWithinEmbedWrapper(node)) { - node.replace(createPreviewNode(editor, node)); - } - } else { - if (!isWithinEmbedWrapper(node)) { - node.replace(createPlaceholderNode(editor, node)); - } - } - } - }; - }; - - var setup = function (editor) { - editor.on('preInit', function () { - var specialElements = editor.schema.getSpecialElements(); - global$1.each('video audio iframe object'.split(' '), function (name) { - specialElements[name] = new RegExp(']*>', 'gi'); - }); - var boolAttrs = editor.schema.getBoolAttrs(); - global$1.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function (name) { - boolAttrs[name] = {}; - }); - editor.parser.addNodeFilter('iframe,video,audio,object,embed,script', placeHolderConverter(editor)); - editor.serializer.addAttributeFilter('data-mce-object', function (nodes, name) { - var i = nodes.length; - var node; - var realElm; - var ai; - var attribs; - var innerHtml; - var innerNode; - var realElmName; - var className; - while (i--) { - node = nodes[i]; - if (!node.parent) { - continue; - } - realElmName = node.attr(name); - realElm = new global$7(realElmName, 1); - if (realElmName !== 'audio' && realElmName !== 'script') { - className = node.attr('class'); - if (className && className.indexOf('mce-preview-object') !== -1) { - realElm.attr({ - width: node.firstChild.attr('width'), - height: node.firstChild.attr('height') - }); - } else { - realElm.attr({ - width: node.attr('width'), - height: node.attr('height') - }); - } - } - realElm.attr({ style: node.attr('style') }); - attribs = node.attributes; - ai = attribs.length; - while (ai--) { - var attrName = attribs[ai].name; - if (attrName.indexOf('data-mce-p-') === 0) { - realElm.attr(attrName.substr(11), attribs[ai].value); - } - } - if (realElmName === 'script') { - realElm.attr('type', 'text/javascript'); - } - innerHtml = node.attr('data-mce-html'); - if (innerHtml) { - innerNode = new global$7('#text', 3); - innerNode.raw = true; - innerNode.value = sanitize(editor, unescape(innerHtml)); - realElm.append(innerNode); - } - node.replace(realElm); - } - }); - }); - editor.on('SetContent', function () { - editor.$('span.mce-preview-object').each(function (index, elm) { - var $elm = editor.$(elm); - if ($elm.find('span.mce-shim').length === 0) { - $elm.append(''); - } - }); - }); - }; - - var setup$1 = function (editor) { - editor.on('ResolveName', function (e) { - var name; - if (e.target.nodeType === 1 && (name = e.target.getAttribute('data-mce-object'))) { - e.name = name; - } - }); - }; - - var setup$2 = function (editor) { - editor.on('click keyup touchend', function () { - var selectedNode = editor.selection.getNode(); - if (selectedNode && editor.dom.hasClass(selectedNode, 'mce-preview-object')) { - if (editor.dom.getAttrib(selectedNode, 'data-mce-selected')) { - selectedNode.setAttribute('data-mce-selected', '2'); - } - } - }); - editor.on('ObjectSelected', function (e) { - var objectType = e.target.getAttribute('data-mce-object'); - if (objectType === 'script') { - e.preventDefault(); - } - }); - editor.on('ObjectResized', function (e) { - var target = e.target; - var html; - if (target.getAttribute('data-mce-object')) { - html = target.getAttribute('data-mce-html'); - if (html) { - html = unescape(html); - target.setAttribute('data-mce-html', escape(updateHtml(html, { - width: String(e.width), - height: String(e.height) - }))); - } - } - }); - }; - - var stateSelectorAdapter = function (editor, selector) { - return function (buttonApi) { - return editor.selection.selectorChangedWithUnbind(selector.join(','), buttonApi.setActive).unbind; - }; - }; - var register$1 = function (editor) { - editor.ui.registry.addToggleButton('media', { - tooltip: 'Insert/edit media', - icon: 'embed', - onAction: function () { - editor.execCommand('mceMedia'); - }, - onSetup: stateSelectorAdapter(editor, [ - 'img[data-mce-object]', - 'span[data-mce-object]', - 'div[data-ephox-embed-iri]' - ]) - }); - editor.ui.registry.addMenuItem('media', { - icon: 'embed', - text: 'Media...', - onAction: function () { - editor.execCommand('mceMedia'); - } - }); - }; - - function Plugin () { - global.add('media', function (editor) { - register(editor); - register$1(editor); - setup$1(editor); - setup(editor); - setup$2(editor); - return get$1(editor); - }); - } - - Plugin(); - -}()); diff --git a/public/js/tinymce/dev/readme.txt b/public/js/tinymce/dev/readme.txt deleted file mode 100644 index 607bf78de..000000000 --- a/public/js/tinymce/dev/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -・public\js\tinymce\dev 配下は、実際に動作していないJS -・軽量化(Minify)してないJSを配置して、元ソースを確認するために配置。 diff --git a/public/js/tinymce/dev/themes/silver/theme.js b/public/js/tinymce/dev/themes/silver/theme.js deleted file mode 100644 index 0b99abeb6..000000000 --- a/public/js/tinymce/dev/themes/silver/theme.js +++ /dev/null @@ -1,32528 +0,0 @@ -/** - * Copyright (c) Tiny Technologies, Inc. All rights reserved. - * Licensed under the LGPL or a commercial license. - * For LGPL see License.txt in the project root for license information. - * For commercial licenses see https://www.tiny.cloud/ - * - * Version: 5.8.0 (2021-05-06) - */ -(function () { - 'use strict'; - - var typeOf = function (x) { - var t = typeof x; - if (x === null) { - return 'null'; - } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { - return 'array'; - } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { - return 'string'; - } else { - return t; - } - }; - var isType = function (type) { - return function (value) { - return typeOf(value) === type; - }; - }; - var isSimpleType = function (type) { - return function (value) { - return typeof value === type; - }; - }; - var eq = function (t) { - return function (a) { - return t === a; - }; - }; - var isString = isType('string'); - var isObject = isType('object'); - var isArray = isType('array'); - var isBoolean = isSimpleType('boolean'); - var isUndefined = eq(undefined); - var isNullable = function (a) { - return a === null || a === undefined; - }; - var isNonNullable = function (a) { - return !isNullable(a); - }; - var isFunction = isSimpleType('function'); - var isNumber = isSimpleType('number'); - var isArrayOf = function (value, pred) { - if (isArray(value)) { - for (var i = 0, len = value.length; i < len; ++i) { - if (!pred(value[i])) { - return false; - } - } - return true; - } - return false; - }; - - var noop = function () { - }; - var noarg = function (f) { - return function () { - return f(); - }; - }; - var compose = function (fa, fb) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return fa(fb.apply(null, args)); - }; - }; - var compose1 = function (fbc, fab) { - return function (a) { - return fbc(fab(a)); - }; - }; - var constant = function (value) { - return function () { - return value; - }; - }; - var identity = function (x) { - return x; - }; - function curry(fn) { - var initialArgs = []; - for (var _i = 1; _i < arguments.length; _i++) { - initialArgs[_i - 1] = arguments[_i]; - } - return function () { - var restArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - restArgs[_i] = arguments[_i]; - } - var all = initialArgs.concat(restArgs); - return fn.apply(null, all); - }; - } - var not = function (f) { - return function (t) { - return !f(t); - }; - }; - var die = function (msg) { - return function () { - throw new Error(msg); - }; - }; - var never = constant(false); - var always = constant(true); - - var global$1 = tinymce.util.Tools.resolve('tinymce.ThemeManager'); - - var __assign = function () { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) - if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - function __rest(s, e) { - var t = {}; - for (var p in s) - if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - } - function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) - s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - } - - var none = function () { - return NONE; - }; - var NONE = function () { - var eq = function (o) { - return o.isNone(); - }; - var call = function (thunk) { - return thunk(); - }; - var id = function (n) { - return n; - }; - var me = { - fold: function (n, _s) { - return n(); - }, - is: never, - isSome: never, - isNone: always, - getOr: id, - getOrThunk: call, - getOrDie: function (msg) { - throw new Error(msg || 'error: getOrDie called on none.'); - }, - getOrNull: constant(null), - getOrUndefined: constant(undefined), - or: id, - orThunk: call, - map: none, - each: noop, - bind: none, - exists: never, - forall: always, - filter: none, - equals: eq, - equals_: eq, - toArray: function () { - return []; - }, - toString: constant('none()') - }; - return me; - }(); - var some = function (a) { - var constant_a = constant(a); - var self = function () { - return me; - }; - var bind = function (f) { - return f(a); - }; - var me = { - fold: function (n, s) { - return s(a); - }, - is: function (v) { - return a === v; - }, - isSome: always, - isNone: never, - getOr: constant_a, - getOrThunk: constant_a, - getOrDie: constant_a, - getOrNull: constant_a, - getOrUndefined: constant_a, - or: self, - orThunk: self, - map: function (f) { - return some(f(a)); - }, - each: function (f) { - f(a); - }, - bind: bind, - exists: bind, - forall: bind, - filter: function (f) { - return f(a) ? me : NONE; - }, - toArray: function () { - return [a]; - }, - toString: function () { - return 'some(' + a + ')'; - }, - equals: function (o) { - return o.is(a); - }, - equals_: function (o, elementEq) { - return o.fold(never, function (b) { - return elementEq(a, b); - }); - } - }; - return me; - }; - var from = function (value) { - return value === null || value === undefined ? NONE : some(value); - }; - var Optional = { - some: some, - none: none, - from: from - }; - - var nativeSlice = Array.prototype.slice; - var nativeIndexOf = Array.prototype.indexOf; - var nativePush = Array.prototype.push; - var rawIndexOf = function (ts, t) { - return nativeIndexOf.call(ts, t); - }; - var indexOf = function (xs, x) { - var r = rawIndexOf(xs, x); - return r === -1 ? Optional.none() : Optional.some(r); - }; - var contains = function (xs, x) { - return rawIndexOf(xs, x) > -1; - }; - var exists = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i)) { - return true; - } - } - return false; - }; - var range = function (num, f) { - var r = []; - for (var i = 0; i < num; i++) { - r.push(f(i)); - } - return r; - }; - var chunk = function (array, size) { - var r = []; - for (var i = 0; i < array.length; i += size) { - var s = nativeSlice.call(array, i, i + size); - r.push(s); - } - return r; - }; - var map = function (xs, f) { - var len = xs.length; - var r = new Array(len); - for (var i = 0; i < len; i++) { - var x = xs[i]; - r[i] = f(x, i); - } - return r; - }; - var each = function (xs, f) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - f(x, i); - } - }; - var eachr = function (xs, f) { - for (var i = xs.length - 1; i >= 0; i--) { - var x = xs[i]; - f(x, i); - } - }; - var partition = function (xs, pred) { - var pass = []; - var fail = []; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - var arr = pred(x, i) ? pass : fail; - arr.push(x); - } - return { - pass: pass, - fail: fail - }; - }; - var filter = function (xs, pred) { - var r = []; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i)) { - r.push(x); - } - } - return r; - }; - var foldr = function (xs, f, acc) { - eachr(xs, function (x) { - acc = f(acc, x); - }); - return acc; - }; - var foldl = function (xs, f, acc) { - each(xs, function (x) { - acc = f(acc, x); - }); - return acc; - }; - var findUntil = function (xs, pred, until) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i)) { - return Optional.some(x); - } else if (until(x, i)) { - break; - } - } - return Optional.none(); - }; - var find = function (xs, pred) { - return findUntil(xs, pred, never); - }; - var findIndex = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i)) { - return Optional.some(i); - } - } - return Optional.none(); - }; - var flatten = function (xs) { - var r = []; - for (var i = 0, len = xs.length; i < len; ++i) { - if (!isArray(xs[i])) { - throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs); - } - nativePush.apply(r, xs[i]); - } - return r; - }; - var bind = function (xs, f) { - return flatten(map(xs, f)); - }; - var forall = function (xs, pred) { - for (var i = 0, len = xs.length; i < len; ++i) { - var x = xs[i]; - if (pred(x, i) !== true) { - return false; - } - } - return true; - }; - var reverse = function (xs) { - var r = nativeSlice.call(xs, 0); - r.reverse(); - return r; - }; - var difference = function (a1, a2) { - return filter(a1, function (x) { - return !contains(a2, x); - }); - }; - var mapToObject = function (xs, f) { - var r = {}; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - r[String(x)] = f(x, i); - } - return r; - }; - var sort = function (xs, comparator) { - var copy = nativeSlice.call(xs, 0); - copy.sort(comparator); - return copy; - }; - var get = function (xs, i) { - return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none(); - }; - var head = function (xs) { - return get(xs, 0); - }; - var last = function (xs) { - return get(xs, xs.length - 1); - }; - var from$1 = isFunction(Array.from) ? Array.from : function (x) { - return nativeSlice.call(x); - }; - var findMap = function (arr, f) { - for (var i = 0; i < arr.length; i++) { - var r = f(arr[i], i); - if (r.isSome()) { - return r; - } - } - return Optional.none(); - }; - - var value = function (o) { - var is = function (v) { - return o === v; - }; - var or = function (_opt) { - return value(o); - }; - var orThunk = function (_f) { - return value(o); - }; - var map = function (f) { - return value(f(o)); - }; - var mapError = function (_f) { - return value(o); - }; - var each = function (f) { - f(o); - }; - var bind = function (f) { - return f(o); - }; - var fold = function (_, onValue) { - return onValue(o); - }; - var exists = function (f) { - return f(o); - }; - var forall = function (f) { - return f(o); - }; - var toOptional = function () { - return Optional.some(o); - }; - return { - is: is, - isValue: always, - isError: never, - getOr: constant(o), - getOrThunk: constant(o), - getOrDie: constant(o), - or: or, - orThunk: orThunk, - fold: fold, - map: map, - mapError: mapError, - each: each, - bind: bind, - exists: exists, - forall: forall, - toOptional: toOptional - }; - }; - var error = function (message) { - var getOrThunk = function (f) { - return f(); - }; - var getOrDie = function () { - return die(String(message))(); - }; - var or = function (opt) { - return opt; - }; - var orThunk = function (f) { - return f(); - }; - var map = function (_f) { - return error(message); - }; - var mapError = function (f) { - return error(f(message)); - }; - var bind = function (_f) { - return error(message); - }; - var fold = function (onError, _) { - return onError(message); - }; - return { - is: never, - isValue: never, - isError: always, - getOr: identity, - getOrThunk: getOrThunk, - getOrDie: getOrDie, - or: or, - orThunk: orThunk, - fold: fold, - map: map, - mapError: mapError, - each: noop, - bind: bind, - exists: never, - forall: always, - toOptional: Optional.none - }; - }; - var fromOption = function (opt, err) { - return opt.fold(function () { - return error(err); - }, value); - }; - var Result = { - value: value, - error: error, - fromOption: fromOption - }; - - var SimpleResultType; - (function (SimpleResultType) { - SimpleResultType[SimpleResultType['Error'] = 0] = 'Error'; - SimpleResultType[SimpleResultType['Value'] = 1] = 'Value'; - }(SimpleResultType || (SimpleResultType = {}))); - var fold = function (res, onError, onValue) { - return res.stype === SimpleResultType.Error ? onError(res.serror) : onValue(res.svalue); - }; - var partition$1 = function (results) { - var values = []; - var errors = []; - each(results, function (obj) { - fold(obj, function (err) { - return errors.push(err); - }, function (val) { - return values.push(val); - }); - }); - return { - values: values, - errors: errors - }; - }; - var mapError = function (res, f) { - if (res.stype === SimpleResultType.Error) { - return { - stype: SimpleResultType.Error, - serror: f(res.serror) - }; - } else { - return res; - } - }; - var map$1 = function (res, f) { - if (res.stype === SimpleResultType.Value) { - return { - stype: SimpleResultType.Value, - svalue: f(res.svalue) - }; - } else { - return res; - } - }; - var bind$1 = function (res, f) { - if (res.stype === SimpleResultType.Value) { - return f(res.svalue); - } else { - return res; - } - }; - var bindError = function (res, f) { - if (res.stype === SimpleResultType.Error) { - return f(res.serror); - } else { - return res; - } - }; - var svalue = function (v) { - return { - stype: SimpleResultType.Value, - svalue: v - }; - }; - var serror = function (e) { - return { - stype: SimpleResultType.Error, - serror: e - }; - }; - var toResult = function (res) { - return fold(res, Result.error, Result.value); - }; - var fromResult = function (res) { - return res.fold(serror, svalue); - }; - var SimpleResult = { - fromResult: fromResult, - toResult: toResult, - svalue: svalue, - partition: partition$1, - serror: serror, - bind: bind$1, - bindError: bindError, - map: map$1, - mapError: mapError, - fold: fold - }; - - var keys = Object.keys; - var hasOwnProperty = Object.hasOwnProperty; - var each$1 = function (obj, f) { - var props = keys(obj); - for (var k = 0, len = props.length; k < len; k++) { - var i = props[k]; - var x = obj[i]; - f(x, i); - } - }; - var map$2 = function (obj, f) { - return tupleMap(obj, function (x, i) { - return { - k: i, - v: f(x, i) - }; - }); - }; - var tupleMap = function (obj, f) { - var r = {}; - each$1(obj, function (x, i) { - var tuple = f(x, i); - r[tuple.k] = tuple.v; - }); - return r; - }; - var objAcc = function (r) { - return function (x, i) { - r[i] = x; - }; - }; - var internalFilter = function (obj, pred, onTrue, onFalse) { - var r = {}; - each$1(obj, function (x, i) { - (pred(x, i) ? onTrue : onFalse)(x, i); - }); - return r; - }; - var filter$1 = function (obj, pred) { - var t = {}; - internalFilter(obj, pred, objAcc(t), noop); - return t; - }; - var mapToArray = function (obj, f) { - var r = []; - each$1(obj, function (value, name) { - r.push(f(value, name)); - }); - return r; - }; - var find$1 = function (obj, pred) { - var props = keys(obj); - for (var k = 0, len = props.length; k < len; k++) { - var i = props[k]; - var x = obj[i]; - if (pred(x, i, obj)) { - return Optional.some(x); - } - } - return Optional.none(); - }; - var values = function (obj) { - return mapToArray(obj, function (v) { - return v; - }); - }; - var get$1 = function (obj, key) { - return has(obj, key) ? Optional.from(obj[key]) : Optional.none(); - }; - var has = function (obj, key) { - return hasOwnProperty.call(obj, key); - }; - var hasNonNullableKey = function (obj, key) { - return has(obj, key) && obj[key] !== undefined && obj[key] !== null; - }; - - var generate = function (cases) { - if (!isArray(cases)) { - throw new Error('cases must be an array'); - } - if (cases.length === 0) { - throw new Error('there must be at least one case'); - } - var constructors = []; - var adt = {}; - each(cases, function (acase, count) { - var keys$1 = keys(acase); - if (keys$1.length !== 1) { - throw new Error('one and only one name per case'); - } - var key = keys$1[0]; - var value = acase[key]; - if (adt[key] !== undefined) { - throw new Error('duplicate key detected:' + key); - } else if (key === 'cata') { - throw new Error('cannot have a case named cata (sorry)'); - } else if (!isArray(value)) { - throw new Error('case arguments must be an array'); - } - constructors.push(key); - adt[key] = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var argLength = args.length; - if (argLength !== value.length) { - throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength); - } - var match = function (branches) { - var branchKeys = keys(branches); - if (constructors.length !== branchKeys.length) { - throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\nActual: ' + branchKeys.join(',')); - } - var allReqd = forall(constructors, function (reqKey) { - return contains(branchKeys, reqKey); - }); - if (!allReqd) { - throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\nRequired: ' + constructors.join(', ')); - } - return branches[key].apply(null, args); - }; - return { - fold: function () { - var foldArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - foldArgs[_i] = arguments[_i]; - } - if (foldArgs.length !== cases.length) { - throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + foldArgs.length); - } - var target = foldArgs[count]; - return target.apply(null, args); - }, - match: match, - log: function (label) { - console.log(label, { - constructors: constructors, - constructor: key, - params: args - }); - } - }; - }; - }); - return adt; - }; - var Adt = { generate: generate }; - - var hasOwnProperty$1 = Object.prototype.hasOwnProperty; - var shallow = function (old, nu) { - return nu; - }; - var deep = function (old, nu) { - var bothObjects = isObject(old) && isObject(nu); - return bothObjects ? deepMerge(old, nu) : nu; - }; - var baseMerge = function (merger) { - return function () { - var objects = []; - for (var _i = 0; _i < arguments.length; _i++) { - objects[_i] = arguments[_i]; - } - if (objects.length === 0) { - throw new Error('Can\'t merge zero objects'); - } - var ret = {}; - for (var j = 0; j < objects.length; j++) { - var curObject = objects[j]; - for (var key in curObject) { - if (hasOwnProperty$1.call(curObject, key)) { - ret[key] = merger(ret[key], curObject[key]); - } - } - } - return ret; - }; - }; - var deepMerge = baseMerge(deep); - var merge = baseMerge(shallow); - - var cached = function (f) { - var called = false; - var r; - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (!called) { - called = true; - r = f.apply(null, args); - } - return r; - }; - }; - - var adt = Adt.generate([ - { strict: [] }, - { defaultedThunk: ['fallbackThunk'] }, - { asOption: [] }, - { asDefaultedOptionThunk: ['fallbackThunk'] }, - { mergeWithThunk: ['baseThunk'] } - ]); - var defaulted = function (fallback) { - return adt.defaultedThunk(constant(fallback)); - }; - var mergeWith = function (base) { - return adt.mergeWithThunk(constant(base)); - }; - var strict = adt.strict; - var asOption = adt.asOption; - var defaultedThunk = adt.defaultedThunk; - var asDefaultedOptionThunk = adt.asDefaultedOptionThunk; - var mergeWithThunk = adt.mergeWithThunk; - - var comparison = Adt.generate([ - { - bothErrors: [ - 'error1', - 'error2' - ] - }, - { - firstError: [ - 'error1', - 'value2' - ] - }, - { - secondError: [ - 'value1', - 'error2' - ] - }, - { - bothValues: [ - 'value1', - 'value2' - ] - } - ]); - var partition$2 = function (results) { - var errors = []; - var values = []; - each(results, function (result) { - result.fold(function (err) { - errors.push(err); - }, function (value) { - values.push(value); - }); - }); - return { - errors: errors, - values: values - }; - }; - - var exclude = function (obj, fields) { - var r = {}; - each$1(obj, function (v, k) { - if (!contains(fields, k)) { - r[k] = v; - } - }); - return r; - }; - - var wrap = function (key, value) { - var _a; - return _a = {}, _a[key] = value, _a; - }; - var wrapAll = function (keyvalues) { - var r = {}; - each(keyvalues, function (kv) { - r[kv.key] = kv.value; - }); - return r; - }; - - var exclude$1 = function (obj, fields) { - return exclude(obj, fields); - }; - var wrap$1 = function (key, value) { - return wrap(key, value); - }; - var wrapAll$1 = function (keyvalues) { - return wrapAll(keyvalues); - }; - var mergeValues = function (values, base) { - return values.length === 0 ? Result.value(base) : Result.value(deepMerge(base, merge.apply(undefined, values))); - }; - var mergeErrors = function (errors) { - return Result.error(flatten(errors)); - }; - var consolidate = function (objs, base) { - var partitions = partition$2(objs); - return partitions.errors.length > 0 ? mergeErrors(partitions.errors) : mergeValues(partitions.values, base); - }; - - var mergeValues$1 = function (values, base) { - return values.length > 0 ? SimpleResult.svalue(deepMerge(base, merge.apply(undefined, values))) : SimpleResult.svalue(base); - }; - var mergeErrors$1 = function (errors) { - return compose(SimpleResult.serror, flatten)(errors); - }; - var consolidateObj = function (objects, base) { - var partition = SimpleResult.partition(objects); - return partition.errors.length > 0 ? mergeErrors$1(partition.errors) : mergeValues$1(partition.values, base); - }; - var consolidateArr = function (objects) { - var partitions = SimpleResult.partition(objects); - return partitions.errors.length > 0 ? mergeErrors$1(partitions.errors) : SimpleResult.svalue(partitions.values); - }; - var ResultCombine = { - consolidateObj: consolidateObj, - consolidateArr: consolidateArr - }; - - var formatObj = function (input) { - return isObject(input) && keys(input).length > 100 ? ' removed due to size' : JSON.stringify(input, null, 2); - }; - var formatErrors = function (errors) { - var es = errors.length > 10 ? errors.slice(0, 10).concat([{ - path: [], - getErrorInfo: function () { - return '... (only showing first ten failures)'; - } - }]) : errors; - return map(es, function (e) { - return 'Failed path: (' + e.path.join(' > ') + ')\n' + e.getErrorInfo(); - }); - }; - - var nu = function (path, getErrorInfo) { - return SimpleResult.serror([{ - path: path, - getErrorInfo: getErrorInfo - }]); - }; - var missingStrict = function (path, key, obj) { - return nu(path, function () { - return 'Could not find valid *strict* value for "' + key + '" in ' + formatObj(obj); - }); - }; - var missingKey = function (path, key) { - return nu(path, function () { - return 'Choice schema did not contain choice key: "' + key + '"'; - }); - }; - var missingBranch = function (path, branches, branch) { - return nu(path, function () { - return 'The chosen schema: "' + branch + '" did not exist in branches: ' + formatObj(branches); - }); - }; - var unsupportedFields = function (path, unsupported) { - return nu(path, function () { - return 'There are unsupported fields: [' + unsupported.join(', ') + '] specified'; - }); - }; - var custom = function (path, err) { - return nu(path, function () { - return err; - }); - }; - - var adt$1 = Adt.generate([ - { - field: [ - 'key', - 'okey', - 'presence', - 'prop' - ] - }, - { - state: [ - 'okey', - 'instantiator' - ] - } - ]); - var strictAccess = function (path, obj, key) { - return get$1(obj, key).fold(function () { - return missingStrict(path, key, obj); - }, SimpleResult.svalue); - }; - var fallbackAccess = function (obj, key, fallbackThunk) { - var v = get$1(obj, key).fold(function () { - return fallbackThunk(obj); - }, identity); - return SimpleResult.svalue(v); - }; - var optionAccess = function (obj, key) { - return SimpleResult.svalue(get$1(obj, key)); - }; - var optionDefaultedAccess = function (obj, key, fallback) { - var opt = get$1(obj, key).map(function (val) { - return val === true ? fallback(obj) : val; - }); - return SimpleResult.svalue(opt); - }; - var cExtractOne = function (path, obj, field, strength) { - return field.fold(function (key, okey, presence, prop) { - var bundle = function (av) { - var result = prop.extract(path.concat([key]), strength, av); - return SimpleResult.map(result, function (res) { - return wrap(okey, strength(res)); - }); - }; - var bundleAsOption = function (optValue) { - return optValue.fold(function () { - var outcome = wrap(okey, strength(Optional.none())); - return SimpleResult.svalue(outcome); - }, function (ov) { - var result = prop.extract(path.concat([key]), strength, ov); - return SimpleResult.map(result, function (res) { - return wrap(okey, strength(Optional.some(res))); - }); - }); - }; - return function () { - return presence.fold(function () { - return SimpleResult.bind(strictAccess(path, obj, key), bundle); - }, function (fallbackThunk) { - return SimpleResult.bind(fallbackAccess(obj, key, fallbackThunk), bundle); - }, function () { - return SimpleResult.bind(optionAccess(obj, key), bundleAsOption); - }, function (fallbackThunk) { - return SimpleResult.bind(optionDefaultedAccess(obj, key, fallbackThunk), bundleAsOption); - }, function (baseThunk) { - var base = baseThunk(obj); - var result = SimpleResult.map(fallbackAccess(obj, key, constant({})), function (v) { - return deepMerge(base, v); - }); - return SimpleResult.bind(result, bundle); - }); - }(); - }, function (okey, instantiator) { - var state = instantiator(obj); - return SimpleResult.svalue(wrap(okey, strength(state))); - }); - }; - var cExtract = function (path, obj, fields, strength) { - var results = map(fields, function (field) { - return cExtractOne(path, obj, field, strength); - }); - return ResultCombine.consolidateObj(results, {}); - }; - var valueThunk = function (getDelegate) { - var extract = function (path, strength, val) { - return getDelegate().extract(path, strength, val); - }; - var toString = function () { - return getDelegate().toString(); - }; - return { - extract: extract, - toString: toString - }; - }; - var value$1 = function (validator) { - var extract = function (path, strength, val) { - return SimpleResult.bindError(validator(val, strength), function (err) { - return custom(path, err); - }); - }; - var toString = function () { - return 'val'; - }; - return { - extract: extract, - toString: toString - }; - }; - var getSetKeys = function (obj) { - return keys(filter$1(obj, function (value) { - return value !== undefined && value !== null; - })); - }; - var objOfOnly = function (fields) { - var delegate = objOf(fields); - var fieldNames = foldr(fields, function (acc, f) { - return f.fold(function (key) { - return deepMerge(acc, wrap$1(key, true)); - }, constant(acc)); - }, {}); - var extract = function (path, strength, o) { - var keys = isBoolean(o) ? [] : getSetKeys(o); - var extra = filter(keys, function (k) { - return !hasNonNullableKey(fieldNames, k); - }); - return extra.length === 0 ? delegate.extract(path, strength, o) : unsupportedFields(path, extra); - }; - return { - extract: extract, - toString: delegate.toString - }; - }; - var objOf = function (fields) { - var extract = function (path, strength, o) { - return cExtract(path, o, fields, strength); - }; - var toString = function () { - var fieldStrings = map(fields, function (field) { - return field.fold(function (key, okey, presence, prop) { - return key + ' -> ' + prop.toString(); - }, function (okey, _instantiator) { - return 'state(' + okey + ')'; - }); - }); - return 'obj{\n' + fieldStrings.join('\n') + '}'; - }; - return { - extract: extract, - toString: toString - }; - }; - var arrOf = function (prop) { - var extract = function (path, strength, array) { - var results = map(array, function (a, i) { - return prop.extract(path.concat(['[' + i + ']']), strength, a); - }); - return ResultCombine.consolidateArr(results); - }; - var toString = function () { - return 'array(' + prop.toString() + ')'; - }; - return { - extract: extract, - toString: toString - }; - }; - var oneOf = function (props) { - var extract = function (path, strength, val) { - var errors = []; - for (var _i = 0, props_1 = props; _i < props_1.length; _i++) { - var prop = props_1[_i]; - var res = prop.extract(path, strength, val); - if (res.stype === SimpleResultType.Value) { - return res; - } - errors.push(res); - } - return ResultCombine.consolidateArr(errors); - }; - var toString = function () { - return 'oneOf(' + map(props, function (prop) { - return prop.toString(); - }).join(', ') + ')'; - }; - return { - extract: extract, - toString: toString - }; - }; - var setOf = function (validator, prop) { - var validateKeys = function (path, keys) { - return arrOf(value$1(validator)).extract(path, identity, keys); - }; - var extract = function (path, strength, o) { - var keys$1 = keys(o); - var validatedKeys = validateKeys(path, keys$1); - return SimpleResult.bind(validatedKeys, function (validKeys) { - var schema = map(validKeys, function (vk) { - return adt$1.field(vk, vk, strict(), prop); - }); - return objOf(schema).extract(path, strength, o); - }); - }; - var toString = function () { - return 'setOf(' + prop.toString() + ')'; - }; - return { - extract: extract, - toString: toString - }; - }; - var thunk = function (desc, processor) { - var getP = cached(function () { - return processor(); - }); - var extract = function (path, strength, val) { - return getP().extract(path, strength, val); - }; - var toString = function () { - return getP().toString(); - }; - return { - extract: extract, - toString: toString - }; - }; - var anyValue = constant(value$1(SimpleResult.svalue)); - var arrOfObj = compose(arrOf, objOf); - var state = adt$1.state; - var field = adt$1.field; - - var chooseFrom = function (path, strength, input, branches, ch) { - var fields = get$1(branches, ch); - return fields.fold(function () { - return missingBranch(path, branches, ch); - }, function (vp) { - return vp.extract(path.concat(['branch: ' + ch]), strength, input); - }); - }; - var choose = function (key, branches) { - var extract = function (path, strength, input) { - var choice = get$1(input, key); - return choice.fold(function () { - return missingKey(path, key); - }, function (chosen) { - return chooseFrom(path, strength, input, branches, chosen); - }); - }; - var toString = function () { - return 'chooseOn(' + key + '). Possible values: ' + keys(branches); - }; - return { - extract: extract, - toString: toString - }; - }; - - var _anyValue = value$1(SimpleResult.svalue); - var arrOfObj$1 = function (objFields) { - return arrOfObj(objFields); - }; - var arrOfVal = function () { - return arrOf(_anyValue); - }; - var valueThunkOf = valueThunk; - var valueOf = function (validator) { - return value$1(function (v) { - return validator(v).fold(SimpleResult.serror, SimpleResult.svalue); - }); - }; - var setOf$1 = function (validator, prop) { - return setOf(function (v) { - return SimpleResult.fromResult(validator(v)); - }, prop); - }; - var extract = function (label, prop, strength, obj) { - var res = prop.extract([label], strength, obj); - return SimpleResult.mapError(res, function (errs) { - return { - input: obj, - errors: errs - }; - }); - }; - var asRaw = function (label, prop, obj) { - return SimpleResult.toResult(extract(label, prop, identity, obj)); - }; - var getOrDie = function (extraction) { - return extraction.fold(function (errInfo) { - throw new Error(formatError(errInfo)); - }, identity); - }; - var asRawOrDie = function (label, prop, obj) { - return getOrDie(asRaw(label, prop, obj)); - }; - var formatError = function (errInfo) { - return 'Errors: \n' + formatErrors(errInfo.errors).join('\n') + '\n\nInput object: ' + formatObj(errInfo.input); - }; - var chooseProcessor = function (key, branches) { - return choose(key, branches); - }; - var choose$1 = function (key, branches) { - return choose(key, map$2(branches, objOf)); - }; - var thunkOf = function (desc, schema) { - return thunk(desc, schema); - }; - var anyValue$1 = constant(_anyValue); - var typedValue = function (validator, expectedType) { - return value$1(function (a) { - var actualType = typeof a; - return validator(a) ? SimpleResult.svalue(a) : SimpleResult.serror('Expected type: ' + expectedType + ' but got: ' + actualType); - }); - }; - var number = typedValue(isNumber, 'number'); - var string = typedValue(isString, 'string'); - var boolean = typedValue(isBoolean, 'boolean'); - var functionProcessor = typedValue(isFunction, 'function'); - var isPostMessageable = function (val) { - var every = function (iter, callbackFn) { - var result = iter.next(); - while (!result.done) { - if (!callbackFn(result.value)) { - return false; - } - result = iter.next(); - } - return true; - }; - if (Object(val) !== val) { - return true; - } - switch ({}.toString.call(val).slice(8, -1)) { - case 'Boolean': - case 'Number': - case 'String': - case 'Date': - case 'RegExp': - case 'Blob': - case 'FileList': - case 'ImageData': - case 'ImageBitmap': - case 'ArrayBuffer': - return true; - case 'Array': - case 'Object': - return Object.keys(val).every(function (prop) { - return isPostMessageable(val[prop]); - }); - case 'Map': - return every(val.keys(), isPostMessageable) && every(val.values(), isPostMessageable); - case 'Set': - return every(val.keys(), isPostMessageable); - default: - return false; - } - }; - var postMessageable = value$1(function (a) { - return isPostMessageable(a) ? SimpleResult.svalue(a) : SimpleResult.serror('Expected value to be acceptable for sending via postMessage'); - }); - - var validateEnum = function (values) { - return valueOf(function (value) { - return contains(values, value) ? Result.value(value) : Result.error('Unsupported value: "' + value + '", choose one of "' + values.join(', ') + '".'); - }); - }; - var strict$1 = function (key) { - return field(key, key, strict(), anyValue()); - }; - var strictOf = function (key, schema) { - return field(key, key, strict(), schema); - }; - var strictNumber = function (key) { - return strictOf(key, number); - }; - var strictString = function (key) { - return strictOf(key, string); - }; - var strictStringEnum = function (key, values) { - return field(key, key, strict(), validateEnum(values)); - }; - var strictBoolean = function (key) { - return strictOf(key, boolean); - }; - var strictFunction = function (key) { - return strictOf(key, functionProcessor); - }; - var forbid = function (key, message) { - return field(key, key, asOption(), value$1(function (_v) { - return SimpleResult.serror('The field: ' + key + ' is forbidden. ' + message); - })); - }; - var strictObjOf = function (key, objSchema) { - return field(key, key, strict(), objOf(objSchema)); - }; - var strictArrayOfObj = function (key, objFields) { - return field(key, key, strict(), arrOfObj(objFields)); - }; - var strictArrayOf = function (key, schema) { - return field(key, key, strict(), arrOf(schema)); - }; - var option = function (key) { - return field(key, key, asOption(), anyValue()); - }; - var optionOf = function (key, schema) { - return field(key, key, asOption(), schema); - }; - var optionNumber = function (key) { - return optionOf(key, number); - }; - var optionString = function (key) { - return optionOf(key, string); - }; - var optionFunction = function (key) { - return optionOf(key, functionProcessor); - }; - var optionArrayOf = function (key, schema) { - return optionOf(key, arrOf(schema)); - }; - var optionObjOf = function (key, objSchema) { - return optionOf(key, objOf(objSchema)); - }; - var optionObjOfOnly = function (key, objSchema) { - return optionOf(key, objOfOnly(objSchema)); - }; - var defaulted$1 = function (key, fallback) { - return field(key, key, defaulted(fallback), anyValue()); - }; - var defaultedOf = function (key, fallback, schema) { - return field(key, key, defaulted(fallback), schema); - }; - var defaultedNumber = function (key, fallback) { - return defaultedOf(key, fallback, number); - }; - var defaultedString = function (key, fallback) { - return defaultedOf(key, fallback, string); - }; - var defaultedStringEnum = function (key, fallback, values) { - return defaultedOf(key, fallback, validateEnum(values)); - }; - var defaultedBoolean = function (key, fallback) { - return defaultedOf(key, fallback, boolean); - }; - var defaultedFunction = function (key, fallback) { - return defaultedOf(key, fallback, functionProcessor); - }; - var defaultedPostMsg = function (key, fallback) { - return defaultedOf(key, fallback, postMessageable); - }; - var defaultedArrayOf = function (key, fallback, schema) { - return defaultedOf(key, fallback, arrOf(schema)); - }; - var defaultedObjOf = function (key, fallback, objSchema) { - return defaultedOf(key, fallback, objOf(objSchema)); - }; - var state$1 = function (okey, instantiator) { - return state(okey, instantiator); - }; - - var Cell = function (initial) { - var value = initial; - var get = function () { - return value; - }; - var set = function (v) { - value = v; - }; - return { - get: get, - set: set - }; - }; - - var fromHtml = function (html, scope) { - var doc = scope || document; - var div = doc.createElement('div'); - div.innerHTML = html; - if (!div.hasChildNodes() || div.childNodes.length > 1) { - console.error('HTML does not have a single root node', html); - throw new Error('HTML must have a single root node'); - } - return fromDom(div.childNodes[0]); - }; - var fromTag = function (tag, scope) { - var doc = scope || document; - var node = doc.createElement(tag); - return fromDom(node); - }; - var fromText = function (text, scope) { - var doc = scope || document; - var node = doc.createTextNode(text); - return fromDom(node); - }; - var fromDom = function (node) { - if (node === null || node === undefined) { - throw new Error('Node cannot be null or undefined'); - } - return { dom: node }; - }; - var fromPoint = function (docElm, x, y) { - return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom); - }; - var SugarElement = { - fromHtml: fromHtml, - fromTag: fromTag, - fromText: fromText, - fromDom: fromDom, - fromPoint: fromPoint - }; - - var DeviceType = function (os, browser, userAgent, mediaMatch) { - var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true; - var isiPhone = os.isiOS() && !isiPad; - var isMobile = os.isiOS() || os.isAndroid(); - var isTouch = isMobile || mediaMatch('(pointer:coarse)'); - var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)'); - var isPhone = isiPhone || isMobile && !isTablet; - var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false; - var isDesktop = !isPhone && !isTablet && !iOSwebview; - return { - isiPad: constant(isiPad), - isiPhone: constant(isiPhone), - isTablet: constant(isTablet), - isPhone: constant(isPhone), - isTouch: constant(isTouch), - isAndroid: os.isAndroid, - isiOS: os.isiOS, - isWebView: constant(iOSwebview), - isDesktop: constant(isDesktop) - }; - }; - - var firstMatch = function (regexes, s) { - for (var i = 0; i < regexes.length; i++) { - var x = regexes[i]; - if (x.test(s)) { - return x; - } - } - return undefined; - }; - var find$2 = function (regexes, agent) { - var r = firstMatch(regexes, agent); - if (!r) { - return { - major: 0, - minor: 0 - }; - } - var group = function (i) { - return Number(agent.replace(r, '$' + i)); - }; - return nu$1(group(1), group(2)); - }; - var detect = function (versionRegexes, agent) { - var cleanedAgent = String(agent).toLowerCase(); - if (versionRegexes.length === 0) { - return unknown(); - } - return find$2(versionRegexes, cleanedAgent); - }; - var unknown = function () { - return nu$1(0, 0); - }; - var nu$1 = function (major, minor) { - return { - major: major, - minor: minor - }; - }; - var Version = { - nu: nu$1, - detect: detect, - unknown: unknown - }; - - var detect$1 = function (candidates, userAgent) { - var agent = String(userAgent).toLowerCase(); - return find(candidates, function (candidate) { - return candidate.search(agent); - }); - }; - var detectBrowser = function (browsers, userAgent) { - return detect$1(browsers, userAgent).map(function (browser) { - var version = Version.detect(browser.versionRegexes, userAgent); - return { - current: browser.name, - version: version - }; - }); - }; - var detectOs = function (oses, userAgent) { - return detect$1(oses, userAgent).map(function (os) { - var version = Version.detect(os.versionRegexes, userAgent); - return { - current: os.name, - version: version - }; - }); - }; - var UaString = { - detectBrowser: detectBrowser, - detectOs: detectOs - }; - - var checkRange = function (str, substr, start) { - return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr; - }; - var contains$1 = function (str, substr) { - return str.indexOf(substr) !== -1; - }; - var endsWith = function (str, suffix) { - return checkRange(str, suffix, str.length - suffix.length); - }; - var blank = function (r) { - return function (s) { - return s.replace(r, ''); - }; - }; - var trim = blank(/^\s+|\s+$/g); - - var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/; - var checkContains = function (target) { - return function (uastring) { - return contains$1(uastring, target); - }; - }; - var browsers = [ - { - name: 'Edge', - versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/], - search: function (uastring) { - return contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit'); - } - }, - { - name: 'Chrome', - versionRegexes: [ - /.*?chrome\/([0-9]+)\.([0-9]+).*/, - normalVersionRegex - ], - search: function (uastring) { - return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe'); - } - }, - { - name: 'IE', - versionRegexes: [ - /.*?msie\ ?([0-9]+)\.([0-9]+).*/, - /.*?rv:([0-9]+)\.([0-9]+).*/ - ], - search: function (uastring) { - return contains$1(uastring, 'msie') || contains$1(uastring, 'trident'); - } - }, - { - name: 'Opera', - versionRegexes: [ - normalVersionRegex, - /.*?opera\/([0-9]+)\.([0-9]+).*/ - ], - search: checkContains('opera') - }, - { - name: 'Firefox', - versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/], - search: checkContains('firefox') - }, - { - name: 'Safari', - versionRegexes: [ - normalVersionRegex, - /.*?cpu os ([0-9]+)_([0-9]+).*/ - ], - search: function (uastring) { - return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit'); - } - } - ]; - var oses = [ - { - name: 'Windows', - search: checkContains('win'), - versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/] - }, - { - name: 'iOS', - search: function (uastring) { - return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad'); - }, - versionRegexes: [ - /.*?version\/\ ?([0-9]+)\.([0-9]+).*/, - /.*cpu os ([0-9]+)_([0-9]+).*/, - /.*cpu iphone os ([0-9]+)_([0-9]+).*/ - ] - }, - { - name: 'Android', - search: checkContains('android'), - versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/] - }, - { - name: 'OSX', - search: checkContains('mac os x'), - versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/] - }, - { - name: 'Linux', - search: checkContains('linux'), - versionRegexes: [] - }, - { - name: 'Solaris', - search: checkContains('sunos'), - versionRegexes: [] - }, - { - name: 'FreeBSD', - search: checkContains('freebsd'), - versionRegexes: [] - }, - { - name: 'ChromeOS', - search: checkContains('cros'), - versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/] - } - ]; - var PlatformInfo = { - browsers: constant(browsers), - oses: constant(oses) - }; - - var edge = 'Edge'; - var chrome = 'Chrome'; - var ie = 'IE'; - var opera = 'Opera'; - var firefox = 'Firefox'; - var safari = 'Safari'; - var unknown$1 = function () { - return nu$2({ - current: undefined, - version: Version.unknown() - }); - }; - var nu$2 = function (info) { - var current = info.current; - var version = info.version; - var isBrowser = function (name) { - return function () { - return current === name; - }; - }; - return { - current: current, - version: version, - isEdge: isBrowser(edge), - isChrome: isBrowser(chrome), - isIE: isBrowser(ie), - isOpera: isBrowser(opera), - isFirefox: isBrowser(firefox), - isSafari: isBrowser(safari) - }; - }; - var Browser = { - unknown: unknown$1, - nu: nu$2, - edge: constant(edge), - chrome: constant(chrome), - ie: constant(ie), - opera: constant(opera), - firefox: constant(firefox), - safari: constant(safari) - }; - - var windows = 'Windows'; - var ios = 'iOS'; - var android = 'Android'; - var linux = 'Linux'; - var osx = 'OSX'; - var solaris = 'Solaris'; - var freebsd = 'FreeBSD'; - var chromeos = 'ChromeOS'; - var unknown$2 = function () { - return nu$3({ - current: undefined, - version: Version.unknown() - }); - }; - var nu$3 = function (info) { - var current = info.current; - var version = info.version; - var isOS = function (name) { - return function () { - return current === name; - }; - }; - return { - current: current, - version: version, - isWindows: isOS(windows), - isiOS: isOS(ios), - isAndroid: isOS(android), - isOSX: isOS(osx), - isLinux: isOS(linux), - isSolaris: isOS(solaris), - isFreeBSD: isOS(freebsd), - isChromeOS: isOS(chromeos) - }; - }; - var OperatingSystem = { - unknown: unknown$2, - nu: nu$3, - windows: constant(windows), - ios: constant(ios), - android: constant(android), - linux: constant(linux), - osx: constant(osx), - solaris: constant(solaris), - freebsd: constant(freebsd), - chromeos: constant(chromeos) - }; - - var detect$2 = function (userAgent, mediaMatch) { - var browsers = PlatformInfo.browsers(); - var oses = PlatformInfo.oses(); - var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu); - var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu); - var deviceType = DeviceType(os, browser, userAgent, mediaMatch); - return { - browser: browser, - os: os, - deviceType: deviceType - }; - }; - var PlatformDetection = { detect: detect$2 }; - - var mediaMatch = function (query) { - return window.matchMedia(query).matches; - }; - var platform = cached(function () { - return PlatformDetection.detect(navigator.userAgent, mediaMatch); - }); - var detect$3 = function () { - return platform(); - }; - - var compareDocumentPosition = function (a, b, match) { - return (a.compareDocumentPosition(b) & match) !== 0; - }; - var documentPositionContainedBy = function (a, b) { - return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY); - }; - - var DOCUMENT = 9; - var DOCUMENT_FRAGMENT = 11; - var ELEMENT = 1; - var TEXT = 3; - - var is = function (element, selector) { - var dom = element.dom; - if (dom.nodeType !== ELEMENT) { - return false; - } else { - var elem = dom; - if (elem.matches !== undefined) { - return elem.matches(selector); - } else if (elem.msMatchesSelector !== undefined) { - return elem.msMatchesSelector(selector); - } else if (elem.webkitMatchesSelector !== undefined) { - return elem.webkitMatchesSelector(selector); - } else if (elem.mozMatchesSelector !== undefined) { - return elem.mozMatchesSelector(selector); - } else { - throw new Error('Browser lacks native selectors'); - } - } - }; - var bypassSelector = function (dom) { - return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0; - }; - var all = function (selector, scope) { - var base = scope === undefined ? document : scope.dom; - return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), SugarElement.fromDom); - }; - var one = function (selector, scope) { - var base = scope === undefined ? document : scope.dom; - return bypassSelector(base) ? Optional.none() : Optional.from(base.querySelector(selector)).map(SugarElement.fromDom); - }; - - var eq$1 = function (e1, e2) { - return e1.dom === e2.dom; - }; - var regularContains = function (e1, e2) { - var d1 = e1.dom; - var d2 = e2.dom; - return d1 === d2 ? false : d1.contains(d2); - }; - var ieContains = function (e1, e2) { - return documentPositionContainedBy(e1.dom, e2.dom); - }; - var contains$2 = function (e1, e2) { - return detect$3().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2); - }; - - var ensureIsRoot = function (isRoot) { - return isFunction(isRoot) ? isRoot : never; - }; - var ancestor = function (scope, transform, isRoot) { - var element = scope.dom; - var stop = ensureIsRoot(isRoot); - while (element.parentNode) { - element = element.parentNode; - var el = SugarElement.fromDom(element); - var transformed = transform(el); - if (transformed.isSome()) { - return transformed; - } else if (stop(el)) { - break; - } - } - return Optional.none(); - }; - var closest = function (scope, transform, isRoot) { - var current = transform(scope); - var stop = ensureIsRoot(isRoot); - return current.orThunk(function () { - return stop(scope) ? Optional.none() : ancestor(scope, transform, stop); - }); - }; - - var isSource = function (component, simulatedEvent) { - return eq$1(component.element, simulatedEvent.event.target); - }; - - var nu$4 = function (parts) { - if (!hasNonNullableKey(parts, 'can') && !hasNonNullableKey(parts, 'abort') && !hasNonNullableKey(parts, 'run')) { - throw new Error('EventHandler defined by: ' + JSON.stringify(parts, null, 2) + ' does not have can, abort, or run!'); - } - return asRawOrDie('Extracting event.handler', objOfOnly([ - defaulted$1('can', always), - defaulted$1('abort', never), - defaulted$1('run', noop) - ]), parts); - }; - var all$1 = function (handlers, f) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return foldl(handlers, function (acc, handler) { - return acc && f(handler).apply(undefined, args); - }, true); - }; - }; - var any = function (handlers, f) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return foldl(handlers, function (acc, handler) { - return acc || f(handler).apply(undefined, args); - }, false); - }; - }; - var read = function (handler) { - return isFunction(handler) ? { - can: always, - abort: never, - run: handler - } : handler; - }; - var fuse = function (handlers) { - var can = all$1(handlers, function (handler) { - return handler.can; - }); - var abort = any(handlers, function (handler) { - return handler.abort; - }); - var run = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - each(handlers, function (handler) { - handler.run.apply(undefined, args); - }); - }; - return nu$4({ - can: can, - abort: abort, - run: run - }); - }; - - var constant$1 = constant; - var touchstart = constant$1('touchstart'); - var touchmove = constant$1('touchmove'); - var touchend = constant$1('touchend'); - var touchcancel = constant$1('touchcancel'); - var mousedown = constant$1('mousedown'); - var mousemove = constant$1('mousemove'); - var mouseout = constant$1('mouseout'); - var mouseup = constant$1('mouseup'); - var mouseover = constant$1('mouseover'); - var focusin = constant$1('focusin'); - var focusout = constant$1('focusout'); - var keydown = constant$1('keydown'); - var keyup = constant$1('keyup'); - var input = constant$1('input'); - var change = constant$1('change'); - var click = constant$1('click'); - var transitionend = constant$1('transitionend'); - var selectstart = constant$1('selectstart'); - - var prefixName = function (name) { - return constant('alloy.' + name); - }; - var alloy = { tap: prefixName('tap') }; - var focus = prefixName('focus'); - var postBlur = prefixName('blur.post'); - var postPaste = prefixName('paste.post'); - var receive = prefixName('receive'); - var execute = prefixName('execute'); - var focusItem = prefixName('focus.item'); - var tap = alloy.tap; - var longpress = prefixName('longpress'); - var sandboxClose = prefixName('sandbox.close'); - var typeaheadCancel = prefixName('typeahead.cancel'); - var systemInit = prefixName('system.init'); - var documentTouchmove = prefixName('system.touchmove'); - var documentTouchend = prefixName('system.touchend'); - var windowScroll = prefixName('system.scroll'); - var windowResize = prefixName('system.resize'); - var attachedToDom = prefixName('system.attached'); - var detachedFromDom = prefixName('system.detached'); - var dismissRequested = prefixName('system.dismissRequested'); - var repositionRequested = prefixName('system.repositionRequested'); - var focusShifted = prefixName('focusmanager.shifted'); - var slotVisibility = prefixName('slotcontainer.visibility'); - var changeTab = prefixName('change.tab'); - var dismissTab = prefixName('dismiss.tab'); - var highlight = prefixName('highlight'); - var dehighlight = prefixName('dehighlight'); - - var emit = function (component, event) { - dispatchWith(component, component.element, event, {}); - }; - var emitWith = function (component, event, properties) { - dispatchWith(component, component.element, event, properties); - }; - var emitExecute = function (component) { - emit(component, execute()); - }; - var dispatch = function (component, target, event) { - dispatchWith(component, target, event, {}); - }; - var dispatchWith = function (component, target, event, properties) { - var data = __assign({ target: target }, properties); - component.getSystem().triggerEvent(event, target, data); - }; - var dispatchEvent = function (component, target, event, simulatedEvent) { - component.getSystem().triggerEvent(event, target, simulatedEvent.event); - }; - - var derive = function (configs) { - return wrapAll$1(configs); - }; - var abort = function (name, predicate) { - return { - key: name, - value: nu$4({ abort: predicate }) - }; - }; - var can = function (name, predicate) { - return { - key: name, - value: nu$4({ can: predicate }) - }; - }; - var preventDefault = function (name) { - return { - key: name, - value: nu$4({ - run: function (component, simulatedEvent) { - simulatedEvent.event.prevent(); - } - }) - }; - }; - var run = function (name, handler) { - return { - key: name, - value: nu$4({ run: handler }) - }; - }; - var runActionExtra = function (name, action, extra) { - return { - key: name, - value: nu$4({ - run: function (component, simulatedEvent) { - action.apply(undefined, [ - component, - simulatedEvent - ].concat(extra)); - } - }) - }; - }; - var runOnName = function (name) { - return function (handler) { - return run(name, handler); - }; - }; - var runOnSourceName = function (name) { - return function (handler) { - return { - key: name, - value: nu$4({ - run: function (component, simulatedEvent) { - if (isSource(component, simulatedEvent)) { - handler(component, simulatedEvent); - } - } - }) - }; - }; - }; - var redirectToUid = function (name, uid) { - return run(name, function (component, simulatedEvent) { - component.getSystem().getByUid(uid).each(function (redirectee) { - dispatchEvent(redirectee, redirectee.element, name, simulatedEvent); - }); - }); - }; - var redirectToPart = function (name, detail, partName) { - var uid = detail.partUids[partName]; - return redirectToUid(name, uid); - }; - var runWithTarget = function (name, f) { - return run(name, function (component, simulatedEvent) { - var ev = simulatedEvent.event; - var target = component.getSystem().getByDom(ev.target).fold(function () { - var closest$1 = closest(ev.target, function (el) { - return component.getSystem().getByDom(el).toOptional(); - }, never); - return closest$1.getOr(component); - }, function (c) { - return c; - }); - f(component, target, simulatedEvent); - }); - }; - var cutter = function (name) { - return run(name, function (component, simulatedEvent) { - simulatedEvent.cut(); - }); - }; - var stopper = function (name) { - return run(name, function (component, simulatedEvent) { - simulatedEvent.stop(); - }); - }; - var runOnSource = function (name, f) { - return runOnSourceName(name)(f); - }; - var runOnAttached = runOnSourceName(attachedToDom()); - var runOnDetached = runOnSourceName(detachedFromDom()); - var runOnInit = runOnSourceName(systemInit()); - var runOnExecute = runOnName(execute()); - - var Global = typeof window !== 'undefined' ? window : Function('return this;')(); - - var name = function (element) { - var r = element.dom.nodeName; - return r.toLowerCase(); - }; - var type = function (element) { - return element.dom.nodeType; - }; - var isType$1 = function (t) { - return function (element) { - return type(element) === t; - }; - }; - var isElement = isType$1(ELEMENT); - var isText = isType$1(TEXT); - var isDocument = isType$1(DOCUMENT); - var isDocumentFragment = isType$1(DOCUMENT_FRAGMENT); - - var owner = function (element) { - return SugarElement.fromDom(element.dom.ownerDocument); - }; - var documentOrOwner = function (dos) { - return isDocument(dos) ? dos : owner(dos); - }; - var documentElement = function (element) { - return SugarElement.fromDom(documentOrOwner(element).dom.documentElement); - }; - var defaultView = function (element) { - return SugarElement.fromDom(documentOrOwner(element).dom.defaultView); - }; - var parent = function (element) { - return Optional.from(element.dom.parentNode).map(SugarElement.fromDom); - }; - var parentNode = function (element) { - return parent(element); - }; - var offsetParent = function (element) { - return Optional.from(element.dom.offsetParent).map(SugarElement.fromDom); - }; - var nextSibling = function (element) { - return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom); - }; - var children = function (element) { - return map(element.dom.childNodes, SugarElement.fromDom); - }; - var child = function (element, index) { - var cs = element.dom.childNodes; - return Optional.from(cs[index]).map(SugarElement.fromDom); - }; - var firstChild = function (element) { - return child(element, 0); - }; - - var isShadowRoot = function (dos) { - return isDocumentFragment(dos) && isNonNullable(dos.dom.host); - }; - var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode); - var isSupported = constant(supported); - var getRootNode = supported ? function (e) { - return SugarElement.fromDom(e.dom.getRootNode()); - } : documentOrOwner; - var getContentContainer = function (dos) { - return isShadowRoot(dos) ? dos : SugarElement.fromDom(documentOrOwner(dos).dom.body); - }; - var isInShadowRoot = function (e) { - return getShadowRoot(e).isSome(); - }; - var getShadowRoot = function (e) { - var r = getRootNode(e); - return isShadowRoot(r) ? Optional.some(r) : Optional.none(); - }; - var getShadowHost = function (e) { - return SugarElement.fromDom(e.dom.host); - }; - var getOriginalEventTarget = function (event) { - if (isSupported() && isNonNullable(event.target)) { - var el = SugarElement.fromDom(event.target); - if (isElement(el) && isOpenShadowHost(el)) { - if (event.composed && event.composedPath) { - var composedPath = event.composedPath(); - if (composedPath) { - return head(composedPath); - } - } - } - } - return Optional.from(event.target); - }; - var isOpenShadowHost = function (element) { - return isNonNullable(element.dom.shadowRoot); - }; - - var before = function (marker, element) { - var parent$1 = parent(marker); - parent$1.each(function (v) { - v.dom.insertBefore(element.dom, marker.dom); - }); - }; - var after = function (marker, element) { - var sibling = nextSibling(marker); - sibling.fold(function () { - var parent$1 = parent(marker); - parent$1.each(function (v) { - append(v, element); - }); - }, function (v) { - before(v, element); - }); - }; - var prepend = function (parent, element) { - var firstChild$1 = firstChild(parent); - firstChild$1.fold(function () { - append(parent, element); - }, function (v) { - parent.dom.insertBefore(element.dom, v.dom); - }); - }; - var append = function (parent, element) { - parent.dom.appendChild(element.dom); - }; - var appendAt = function (parent, element, index) { - child(parent, index).fold(function () { - append(parent, element); - }, function (v) { - before(v, element); - }); - }; - - var before$1 = function (marker, elements) { - each(elements, function (x) { - before(marker, x); - }); - }; - var append$1 = function (parent, elements) { - each(elements, function (x) { - append(parent, x); - }); - }; - - var empty = function (element) { - element.dom.textContent = ''; - each(children(element), function (rogue) { - remove(rogue); - }); - }; - var remove = function (element) { - var dom = element.dom; - if (dom.parentNode !== null) { - dom.parentNode.removeChild(dom); - } - }; - var unwrap = function (wrapper) { - var children$1 = children(wrapper); - if (children$1.length > 0) { - before$1(wrapper, children$1); - } - remove(wrapper); - }; - - var fromHtml$1 = function (html, scope) { - var doc = scope || document; - var div = doc.createElement('div'); - div.innerHTML = html; - return children(SugarElement.fromDom(div)); - }; - - var get$2 = function (element) { - return element.dom.innerHTML; - }; - var set = function (element, content) { - var owner$1 = owner(element); - var docDom = owner$1.dom; - var fragment = SugarElement.fromDom(docDom.createDocumentFragment()); - var contentElements = fromHtml$1(content, docDom); - append$1(fragment, contentElements); - empty(element); - append(element, fragment); - }; - var getOuter = function (element) { - var container = SugarElement.fromTag('div'); - var clone = SugarElement.fromDom(element.dom.cloneNode(true)); - append(container, clone); - return get$2(container); - }; - - var rawSet = function (dom, key, value) { - if (isString(value) || isBoolean(value) || isNumber(value)) { - dom.setAttribute(key, value + ''); - } else { - console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom); - throw new Error('Attribute value was not simple'); - } - }; - var set$1 = function (element, key, value) { - rawSet(element.dom, key, value); - }; - var setAll = function (element, attrs) { - var dom = element.dom; - each$1(attrs, function (v, k) { - rawSet(dom, k, v); - }); - }; - var get$3 = function (element, key) { - var v = element.dom.getAttribute(key); - return v === null ? undefined : v; - }; - var getOpt = function (element, key) { - return Optional.from(get$3(element, key)); - }; - var has$1 = function (element, key) { - var dom = element.dom; - return dom && dom.hasAttribute ? dom.hasAttribute(key) : false; - }; - var remove$1 = function (element, key) { - element.dom.removeAttribute(key); - }; - - var clone = function (original, isDeep) { - return SugarElement.fromDom(original.dom.cloneNode(isDeep)); - }; - var shallow$1 = function (original) { - return clone(original, false); - }; - - var getHtml = function (element) { - if (isShadowRoot(element)) { - return '#shadow-root'; - } else { - var clone = shallow$1(element); - return getOuter(clone); - } - }; - - var element = function (elem) { - return getHtml(elem); - }; - - var isRecursive = function (component, originator, target) { - return eq$1(originator, component.element) && !eq$1(originator, target); - }; - var events = derive([can(focus(), function (component, simulatedEvent) { - var event = simulatedEvent.event; - var originator = event.originator; - var target = event.target; - if (isRecursive(component, originator, target)) { - console.warn(focus() + ' did not get interpreted by the desired target. ' + '\nOriginator: ' + element(originator) + '\nTarget: ' + element(target) + '\nCheck the ' + focus() + ' event handlers'); - return false; - } else { - return true; - } - })]); - - var DefaultEvents = /*#__PURE__*/Object.freeze({ - __proto__: null, - events: events - }); - - var unique = 0; - var generate$1 = function (prefix) { - var date = new Date(); - var time = date.getTime(); - var random = Math.floor(Math.random() * 1000000000); - unique++; - return prefix + '_' + random + unique + String(time); - }; - - var prefix = constant('alloy-id-'); - var idAttr = constant('data-alloy-id'); - - var prefix$1 = prefix(); - var idAttr$1 = idAttr(); - var write = function (label, elem) { - var id = generate$1(prefix$1 + label); - writeOnly(elem, id); - return id; - }; - var writeOnly = function (elem, uid) { - Object.defineProperty(elem.dom, idAttr$1, { - value: uid, - writable: true - }); - }; - var read$1 = function (elem) { - var id = isElement(elem) ? elem.dom[idAttr$1] : null; - return Optional.from(id); - }; - var generate$2 = function (prefix) { - return generate$1(prefix); - }; - - var make = identity; - - var NoContextApi = function (getComp) { - var fail = function (event) { - return function () { - throw new Error('The component must be in a context to send: ' + event + (getComp ? '\n' + element(getComp().element) + ' is not in context.' : '')); - }; - }; - return { - debugInfo: constant('fake'), - triggerEvent: fail('triggerEvent'), - triggerFocus: fail('triggerFocus'), - triggerEscape: fail('triggerEscape'), - build: fail('build'), - addToWorld: fail('addToWorld'), - removeFromWorld: fail('removeFromWorld'), - addToGui: fail('addToGui'), - removeFromGui: fail('removeFromGui'), - getByUid: fail('getByUid'), - getByDom: fail('getByDom'), - broadcast: fail('broadcast'), - broadcastOn: fail('broadcastOn'), - broadcastEvent: fail('broadcastEvent'), - isConnected: never - }; - }; - var singleton = NoContextApi(); - - var markAsBehaviourApi = function (f, apiName, apiFunction) { - var delegate = apiFunction.toString(); - var endIndex = delegate.indexOf(')') + 1; - var openBracketIndex = delegate.indexOf('('); - var parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/); - f.toFunctionAnnotation = function () { - return { - name: apiName, - parameters: cleanParameters(parameters.slice(0, 1).concat(parameters.slice(3))) - }; - }; - return f; - }; - var cleanParameters = function (parameters) { - return map(parameters, function (p) { - return endsWith(p, '/*') ? p.substring(0, p.length - '/*'.length) : p; - }); - }; - var markAsExtraApi = function (f, extraName) { - var delegate = f.toString(); - var endIndex = delegate.indexOf(')') + 1; - var openBracketIndex = delegate.indexOf('('); - var parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/); - f.toFunctionAnnotation = function () { - return { - name: extraName, - parameters: cleanParameters(parameters) - }; - }; - return f; - }; - var markAsSketchApi = function (f, apiFunction) { - var delegate = apiFunction.toString(); - var endIndex = delegate.indexOf(')') + 1; - var openBracketIndex = delegate.indexOf('('); - var parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\s*/); - f.toFunctionAnnotation = function () { - return { - name: 'OVERRIDE', - parameters: cleanParameters(parameters.slice(1)) - }; - }; - return f; - }; - - var premadeTag = generate$1('alloy-premade'); - var premade = function (comp) { - return wrap$1(premadeTag, comp); - }; - var getPremade = function (spec) { - return get$1(spec, premadeTag); - }; - var makeApi = function (f) { - return markAsSketchApi(function (component) { - var rest = []; - for (var _i = 1; _i < arguments.length; _i++) { - rest[_i - 1] = arguments[_i]; - } - return f.apply(void 0, __spreadArrays([ - component.getApis(), - component - ], rest)); - }, f); - }; - - var NoState = { - init: function () { - return nu$5({ - readState: function () { - return 'No State required'; - } - }); - } - }; - var nu$5 = function (spec) { - return spec; - }; - - var generateFrom = function (spec, all) { - var schema = map(all, function (a) { - return optionObjOf(a.name(), [ - strict$1('config'), - defaulted$1('state', NoState) - ]); - }); - var validated = asRaw('component.behaviours', objOf(schema), spec.behaviours).fold(function (errInfo) { - throw new Error(formatError(errInfo) + '\nComplete spec:\n' + JSON.stringify(spec, null, 2)); - }, function (v) { - return v; - }); - return { - list: all, - data: map$2(validated, function (optBlobThunk) { - var output = optBlobThunk.map(function (blob) { - return { - config: blob.config, - state: blob.state.init(blob.config) - }; - }); - return function () { - return output; - }; - }) - }; - }; - var getBehaviours = function (bData) { - return bData.list; - }; - var getData = function (bData) { - return bData.data; - }; - - var byInnerKey = function (data, tuple) { - var r = {}; - each$1(data, function (detail, key) { - each$1(detail, function (value, indexKey) { - var chain = get$1(r, indexKey).getOr([]); - r[indexKey] = chain.concat([tuple(key, value)]); - }); - }); - return r; - }; - - var nu$6 = function (s) { - return { - classes: s.classes !== undefined ? s.classes : [], - attributes: s.attributes !== undefined ? s.attributes : {}, - styles: s.styles !== undefined ? s.styles : {} - }; - }; - var merge$1 = function (defnA, mod) { - return __assign(__assign({}, defnA), { - attributes: __assign(__assign({}, defnA.attributes), mod.attributes), - styles: __assign(__assign({}, defnA.styles), mod.styles), - classes: defnA.classes.concat(mod.classes) - }); - }; - - var combine = function (info, baseMod, behaviours, base) { - var modsByBehaviour = __assign({}, baseMod); - each(behaviours, function (behaviour) { - modsByBehaviour[behaviour.name()] = behaviour.exhibit(info, base); - }); - var byAspect = byInnerKey(modsByBehaviour, function (name, modification) { - return { - name: name, - modification: modification - }; - }); - var combineObjects = function (objects) { - return foldr(objects, function (b, a) { - return __assign(__assign({}, a.modification), b); - }, {}); - }; - var combinedClasses = foldr(byAspect.classes, function (b, a) { - return a.modification.concat(b); - }, []); - var combinedAttributes = combineObjects(byAspect.attributes); - var combinedStyles = combineObjects(byAspect.styles); - return nu$6({ - classes: combinedClasses, - attributes: combinedAttributes, - styles: combinedStyles - }); - }; - - var sortKeys = function (label, keyName, array, order) { - try { - var sorted = sort(array, function (a, b) { - var aKey = a[keyName]; - var bKey = b[keyName]; - var aIndex = order.indexOf(aKey); - var bIndex = order.indexOf(bKey); - if (aIndex === -1) { - throw new Error('The ordering for ' + label + ' does not have an entry for ' + aKey + '.\nOrder specified: ' + JSON.stringify(order, null, 2)); - } - if (bIndex === -1) { - throw new Error('The ordering for ' + label + ' does not have an entry for ' + bKey + '.\nOrder specified: ' + JSON.stringify(order, null, 2)); - } - if (aIndex < bIndex) { - return -1; - } else if (bIndex < aIndex) { - return 1; - } else { - return 0; - } - }); - return Result.value(sorted); - } catch (err) { - return Result.error([err]); - } - }; - - var uncurried = function (handler, purpose) { - return { - handler: handler, - purpose: purpose - }; - }; - var curried = function (handler, purpose) { - return { - cHandler: handler, - purpose: purpose - }; - }; - var curryArgs = function (descHandler, extraArgs) { - return curried(curry.apply(undefined, [descHandler.handler].concat(extraArgs)), descHandler.purpose); - }; - var getCurried = function (descHandler) { - return descHandler.cHandler; - }; - - var behaviourTuple = function (name, handler) { - return { - name: name, - handler: handler - }; - }; - var nameToHandlers = function (behaviours, info) { - var r = {}; - each(behaviours, function (behaviour) { - r[behaviour.name()] = behaviour.handlers(info); - }); - return r; - }; - var groupByEvents = function (info, behaviours, base) { - var behaviourEvents = __assign(__assign({}, base), nameToHandlers(behaviours, info)); - return byInnerKey(behaviourEvents, behaviourTuple); - }; - var combine$1 = function (info, eventOrder, behaviours, base) { - var byEventName = groupByEvents(info, behaviours, base); - return combineGroups(byEventName, eventOrder); - }; - var assemble = function (rawHandler) { - var handler = read(rawHandler); - return function (component, simulatedEvent) { - var rest = []; - for (var _i = 2; _i < arguments.length; _i++) { - rest[_i - 2] = arguments[_i]; - } - var args = [ - component, - simulatedEvent - ].concat(rest); - if (handler.abort.apply(undefined, args)) { - simulatedEvent.stop(); - } else if (handler.can.apply(undefined, args)) { - handler.run.apply(undefined, args); - } - }; - }; - var missingOrderError = function (eventName, tuples) { - return Result.error(['The event (' + eventName + ') has more than one behaviour that listens to it.\nWhen this occurs, you must ' + 'specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that ' + 'can trigger it are: ' + JSON.stringify(map(tuples, function (c) { - return c.name; - }), null, 2)]); - }; - var fuse$1 = function (tuples, eventOrder, eventName) { - var order = eventOrder[eventName]; - if (!order) { - return missingOrderError(eventName, tuples); - } else { - return sortKeys('Event: ' + eventName, 'name', tuples, order).map(function (sortedTuples) { - var handlers = map(sortedTuples, function (tuple) { - return tuple.handler; - }); - return fuse(handlers); - }); - } - }; - var combineGroups = function (byEventName, eventOrder) { - var r = mapToArray(byEventName, function (tuples, eventName) { - var combined = tuples.length === 1 ? Result.value(tuples[0].handler) : fuse$1(tuples, eventOrder, eventName); - return combined.map(function (handler) { - var assembled = assemble(handler); - var purpose = tuples.length > 1 ? filter(eventOrder[eventName], function (o) { - return exists(tuples, function (t) { - return t.name === o; - }); - }).join(' > ') : tuples[0].name; - return wrap$1(eventName, uncurried(assembled, purpose)); - }); - }); - return consolidate(r, {}); - }; - - var baseBehaviour = 'alloy.base.behaviour'; - var toInfo = function (spec) { - var _a; - return asRaw('custom.definition', objOf([ - field('dom', 'dom', strict(), objOf([ - strict$1('tag'), - defaulted$1('styles', {}), - defaulted$1('classes', []), - defaulted$1('attributes', {}), - option('value'), - option('innerHtml') - ])), - strict$1('components'), - strict$1('uid'), - defaulted$1('events', {}), - defaulted$1('apis', {}), - field('eventOrder', 'eventOrder', mergeWith((_a = {}, _a[execute()] = [ - 'disabling', - baseBehaviour, - 'toggling', - 'typeaheadevents' - ], _a[focus()] = [ - baseBehaviour, - 'focusing', - 'keying' - ], _a[systemInit()] = [ - baseBehaviour, - 'disabling', - 'toggling', - 'representing' - ], _a[input()] = [ - baseBehaviour, - 'representing', - 'streaming', - 'invalidating' - ], _a[detachedFromDom()] = [ - baseBehaviour, - 'representing', - 'item-events', - 'tooltipping' - ], _a[mousedown()] = [ - 'focusing', - baseBehaviour, - 'item-type-events' - ], _a[touchstart()] = [ - 'focusing', - baseBehaviour, - 'item-type-events' - ], _a[mouseover()] = [ - 'item-type-events', - 'tooltipping' - ], _a[receive()] = [ - 'receiving', - 'reflecting', - 'tooltipping' - ], _a)), anyValue$1()), - option('domModification') - ]), spec); - }; - var toDefinition = function (detail) { - return __assign(__assign({}, detail.dom), { - uid: detail.uid, - domChildren: map(detail.components, function (comp) { - return comp.element; - }) - }); - }; - var toModification = function (detail) { - return detail.domModification.fold(function () { - return nu$6({}); - }, nu$6); - }; - var toEvents = function (info) { - return info.events; - }; - - var read$2 = function (element, attr) { - var value = get$3(element, attr); - return value === undefined || value === '' ? [] : value.split(' '); - }; - var add = function (element, attr, id) { - var old = read$2(element, attr); - var nu = old.concat([id]); - set$1(element, attr, nu.join(' ')); - return true; - }; - var remove$2 = function (element, attr, id) { - var nu = filter(read$2(element, attr), function (v) { - return v !== id; - }); - if (nu.length > 0) { - set$1(element, attr, nu.join(' ')); - } else { - remove$1(element, attr); - } - return false; - }; - - var supports = function (element) { - return element.dom.classList !== undefined; - }; - var get$4 = function (element) { - return read$2(element, 'class'); - }; - var add$1 = function (element, clazz) { - return add(element, 'class', clazz); - }; - var remove$3 = function (element, clazz) { - return remove$2(element, 'class', clazz); - }; - - var add$2 = function (element, clazz) { - if (supports(element)) { - element.dom.classList.add(clazz); - } else { - add$1(element, clazz); - } - }; - var cleanClass = function (element) { - var classList = supports(element) ? element.dom.classList : get$4(element); - if (classList.length === 0) { - remove$1(element, 'class'); - } - }; - var remove$4 = function (element, clazz) { - if (supports(element)) { - var classList = element.dom.classList; - classList.remove(clazz); - } else { - remove$3(element, clazz); - } - cleanClass(element); - }; - var has$2 = function (element, clazz) { - return supports(element) && element.dom.classList.contains(clazz); - }; - - var add$3 = function (element, classes) { - each(classes, function (x) { - add$2(element, x); - }); - }; - var remove$5 = function (element, classes) { - each(classes, function (x) { - remove$4(element, x); - }); - }; - - var isSupported$1 = function (dom) { - return dom.style !== undefined && isFunction(dom.style.getPropertyValue); - }; - - var inBody = function (element) { - var dom = isText(element) ? element.dom.parentNode : element.dom; - if (dom === undefined || dom === null || dom.ownerDocument === null) { - return false; - } - var doc = dom.ownerDocument; - return getShadowRoot(SugarElement.fromDom(dom)).fold(function () { - return doc.body.contains(dom); - }, compose1(inBody, getShadowHost)); - }; - var body = function () { - return getBody(SugarElement.fromDom(document)); - }; - var getBody = function (doc) { - var b = doc.dom.body; - if (b === null || b === undefined) { - throw new Error('Body is not available yet'); - } - return SugarElement.fromDom(b); - }; - - var internalSet = function (dom, property, value) { - if (!isString(value)) { - console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom); - throw new Error('CSS value must be a string: ' + value); - } - if (isSupported$1(dom)) { - dom.style.setProperty(property, value); - } - }; - var internalRemove = function (dom, property) { - if (isSupported$1(dom)) { - dom.style.removeProperty(property); - } - }; - var set$2 = function (element, property, value) { - var dom = element.dom; - internalSet(dom, property, value); - }; - var setAll$1 = function (element, css) { - var dom = element.dom; - each$1(css, function (v, k) { - internalSet(dom, k, v); - }); - }; - var setOptions = function (element, css) { - var dom = element.dom; - each$1(css, function (v, k) { - v.fold(function () { - internalRemove(dom, k); - }, function (value) { - internalSet(dom, k, value); - }); - }); - }; - var get$5 = function (element, property) { - var dom = element.dom; - var styles = window.getComputedStyle(dom); - var r = styles.getPropertyValue(property); - return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r; - }; - var getUnsafeProperty = function (dom, property) { - return isSupported$1(dom) ? dom.style.getPropertyValue(property) : ''; - }; - var getRaw = function (element, property) { - var dom = element.dom; - var raw = getUnsafeProperty(dom, property); - return Optional.from(raw).filter(function (r) { - return r.length > 0; - }); - }; - var getAllRaw = function (element) { - var css = {}; - var dom = element.dom; - if (isSupported$1(dom)) { - for (var i = 0; i < dom.style.length; i++) { - var ruleName = dom.style.item(i); - css[ruleName] = dom.style[ruleName]; - } - } - return css; - }; - var isValidValue = function (tag, property, value) { - var element = SugarElement.fromTag(tag); - set$2(element, property, value); - var style = getRaw(element, property); - return style.isSome(); - }; - var remove$6 = function (element, property) { - var dom = element.dom; - internalRemove(dom, property); - if (getOpt(element, 'style').map(trim).is('')) { - remove$1(element, 'style'); - } - }; - var reflow = function (e) { - return e.dom.offsetWidth; - }; - - var get$6 = function (element) { - return element.dom.value; - }; - var set$3 = function (element, value) { - if (value === undefined) { - throw new Error('Value.set was undefined'); - } - element.dom.value = value; - }; - - var renderToDom = function (definition) { - var subject = SugarElement.fromTag(definition.tag); - setAll(subject, definition.attributes); - add$3(subject, definition.classes); - setAll$1(subject, definition.styles); - definition.innerHtml.each(function (html) { - return set(subject, html); - }); - var children = definition.domChildren; - append$1(subject, children); - definition.value.each(function (value) { - set$3(subject, value); - }); - if (!definition.uid) { - debugger; - } - writeOnly(subject, definition.uid); - return subject; - }; - - var getBehaviours$1 = function (spec) { - var behaviours = get$1(spec, 'behaviours').getOr({}); - var keys$1 = filter(keys(behaviours), function (k) { - return behaviours[k] !== undefined; - }); - return map(keys$1, function (k) { - return behaviours[k].me; - }); - }; - var generateFrom$1 = function (spec, all) { - return generateFrom(spec, all); - }; - var generate$3 = function (spec) { - var all = getBehaviours$1(spec); - return generateFrom$1(spec, all); - }; - - var getDomDefinition = function (info, bList, bData) { - var definition = toDefinition(info); - var infoModification = toModification(info); - var baseModification = { 'alloy.base.modification': infoModification }; - var modification = bList.length > 0 ? combine(bData, baseModification, bList, definition) : infoModification; - return merge$1(definition, modification); - }; - var getEvents = function (info, bList, bData) { - var baseEvents = { 'alloy.base.behaviour': toEvents(info) }; - return combine$1(bData, info.eventOrder, bList, baseEvents).getOrDie(); - }; - var build = function (spec) { - var getMe = function () { - return me; - }; - var systemApi = Cell(singleton); - var info = getOrDie(toInfo(spec)); - var bBlob = generate$3(spec); - var bList = getBehaviours(bBlob); - var bData = getData(bBlob); - var modDefinition = getDomDefinition(info, bList, bData); - var item = renderToDom(modDefinition); - var events = getEvents(info, bList, bData); - var subcomponents = Cell(info.components); - var connect = function (newApi) { - systemApi.set(newApi); - }; - var disconnect = function () { - systemApi.set(NoContextApi(getMe)); - }; - var syncComponents = function () { - var children$1 = children(item); - var subs = bind(children$1, function (child) { - return systemApi.get().getByDom(child).fold(function () { - return []; - }, function (c) { - return [c]; - }); - }); - subcomponents.set(subs); - }; - var config = function (behaviour) { - var b = bData; - var f = isFunction(b[behaviour.name()]) ? b[behaviour.name()] : function () { - throw new Error('Could not find ' + behaviour.name() + ' in ' + JSON.stringify(spec, null, 2)); - }; - return f(); - }; - var hasConfigured = function (behaviour) { - return isFunction(bData[behaviour.name()]); - }; - var getApis = function () { - return info.apis; - }; - var readState = function (behaviourName) { - return bData[behaviourName]().map(function (b) { - return b.state.readState(); - }).getOr('not enabled'); - }; - var me = { - getSystem: systemApi.get, - config: config, - hasConfigured: hasConfigured, - spec: spec, - readState: readState, - getApis: getApis, - connect: connect, - disconnect: disconnect, - element: item, - syncComponents: syncComponents, - components: subcomponents.get, - events: events - }; - return me; - }; - - var buildSubcomponents = function (spec) { - var components = get$1(spec, 'components').getOr([]); - return map(components, build$1); - }; - var buildFromSpec = function (userSpec) { - var _a = make(userSpec), specEvents = _a.events, spec = __rest(_a, ['events']); - var components = buildSubcomponents(spec); - var completeSpec = __assign(__assign({}, spec), { - events: __assign(__assign({}, DefaultEvents), specEvents), - components: components - }); - return Result.value(build(completeSpec)); - }; - var text = function (textContent) { - var element = SugarElement.fromText(textContent); - return external({ element: element }); - }; - var external = function (spec) { - var extSpec = asRawOrDie('external.component', objOfOnly([ - strict$1('element'), - option('uid') - ]), spec); - var systemApi = Cell(NoContextApi()); - var connect = function (newApi) { - systemApi.set(newApi); - }; - var disconnect = function () { - systemApi.set(NoContextApi(function () { - return me; - })); - }; - extSpec.uid.each(function (uid) { - writeOnly(extSpec.element, uid); - }); - var me = { - getSystem: systemApi.get, - config: Optional.none, - hasConfigured: never, - connect: connect, - disconnect: disconnect, - getApis: function () { - return {}; - }, - element: extSpec.element, - spec: spec, - readState: constant('No state'), - syncComponents: noop, - components: constant([]), - events: {} - }; - return premade(me); - }; - var uids = generate$2; - var build$1 = function (spec) { - return getPremade(spec).fold(function () { - var userSpecWithUid = spec.hasOwnProperty('uid') ? spec : __assign({ uid: uids('') }, spec); - return buildFromSpec(userSpecWithUid).getOrDie(); - }, function (prebuilt) { - return prebuilt; - }); - }; - var premade$1 = premade; - - var Dimension = function (name, getOffset) { - var set = function (element, h) { - if (!isNumber(h) && !h.match(/^[0-9]+$/)) { - throw new Error(name + '.set accepts only positive integer values. Value was ' + h); - } - var dom = element.dom; - if (isSupported$1(dom)) { - dom.style[name] = h + 'px'; - } - }; - var get = function (element) { - var r = getOffset(element); - if (r <= 0 || r === null) { - var css = get$5(element, name); - return parseFloat(css) || 0; - } - return r; - }; - var getOuter = get; - var aggregate = function (element, properties) { - return foldl(properties, function (acc, property) { - var val = get$5(element, property); - var value = val === undefined ? 0 : parseInt(val, 10); - return isNaN(value) ? acc : acc + value; - }, 0); - }; - var max = function (element, value, properties) { - var cumulativeInclusions = aggregate(element, properties); - var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0; - return absoluteMax; - }; - return { - set: set, - get: get, - getOuter: getOuter, - aggregate: aggregate, - max: max - }; - }; - - var api = Dimension('height', function (element) { - var dom = element.dom; - return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight; - }); - var get$7 = function (element) { - return api.get(element); - }; - var getOuter$1 = function (element) { - return api.getOuter(element); - }; - var setMax = function (element, value) { - var inclusions = [ - 'margin-top', - 'border-top-width', - 'padding-top', - 'padding-bottom', - 'border-bottom-width', - 'margin-bottom' - ]; - var absMax = api.max(element, value, inclusions); - set$2(element, 'max-height', absMax + 'px'); - }; - - var r = function (left, top) { - var translate = function (x, y) { - return r(left + x, top + y); - }; - return { - left: left, - top: top, - translate: translate - }; - }; - var SugarPosition = r; - - var boxPosition = function (dom) { - var box = dom.getBoundingClientRect(); - return SugarPosition(box.left, box.top); - }; - var firstDefinedOrZero = function (a, b) { - if (a !== undefined) { - return a; - } else { - return b !== undefined ? b : 0; - } - }; - var absolute = function (element) { - var doc = element.dom.ownerDocument; - var body = doc.body; - var win = doc.defaultView; - var html = doc.documentElement; - if (body === element.dom) { - return SugarPosition(body.offsetLeft, body.offsetTop); - } - var scrollTop = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageYOffset, html.scrollTop); - var scrollLeft = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageXOffset, html.scrollLeft); - var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop); - var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft); - return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop); - }; - var viewport = function (element) { - var dom = element.dom; - var doc = dom.ownerDocument; - var body = doc.body; - if (body === dom) { - return SugarPosition(body.offsetLeft, body.offsetTop); - } - if (!inBody(element)) { - return SugarPosition(0, 0); - } - return boxPosition(dom); - }; - - var api$1 = Dimension('width', function (element) { - return element.dom.offsetWidth; - }); - var set$4 = function (element, h) { - return api$1.set(element, h); - }; - var get$8 = function (element) { - return api$1.get(element); - }; - var getOuter$2 = function (element) { - return api$1.getOuter(element); - }; - var setMax$1 = function (element, value) { - var inclusions = [ - 'margin-left', - 'border-left-width', - 'padding-left', - 'padding-right', - 'border-right-width', - 'margin-right' - ]; - var absMax = api$1.max(element, value, inclusions); - set$2(element, 'max-width', absMax + 'px'); - }; - - var mkEvent = function (target, x, y, stop, prevent, kill, raw) { - return { - target: target, - x: x, - y: y, - stop: stop, - prevent: prevent, - kill: kill, - raw: raw - }; - }; - var fromRawEvent = function (rawEvent) { - var target = SugarElement.fromDom(getOriginalEventTarget(rawEvent).getOr(rawEvent.target)); - var stop = function () { - return rawEvent.stopPropagation(); - }; - var prevent = function () { - return rawEvent.preventDefault(); - }; - var kill = compose(prevent, stop); - return mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent); - }; - var handle = function (filter, handler) { - return function (rawEvent) { - if (filter(rawEvent)) { - handler(fromRawEvent(rawEvent)); - } - }; - }; - var binder = function (element, event, filter, handler, useCapture) { - var wrapped = handle(filter, handler); - element.dom.addEventListener(event, wrapped, useCapture); - return { unbind: curry(unbind, element, event, wrapped, useCapture) }; - }; - var bind$2 = function (element, event, filter, handler) { - return binder(element, event, filter, handler, false); - }; - var capture = function (element, event, filter, handler) { - return binder(element, event, filter, handler, true); - }; - var unbind = function (element, event, handler, useCapture) { - element.dom.removeEventListener(event, handler, useCapture); - }; - - var get$9 = function (_DOC) { - var doc = _DOC !== undefined ? _DOC.dom : document; - var x = doc.body.scrollLeft || doc.documentElement.scrollLeft; - var y = doc.body.scrollTop || doc.documentElement.scrollTop; - return SugarPosition(x, y); - }; - var to = function (x, y, _DOC) { - var doc = _DOC !== undefined ? _DOC.dom : document; - var win = doc.defaultView; - if (win) { - win.scrollTo(x, y); - } - }; - - var get$a = function (_win) { - var win = _win === undefined ? window : _win; - return Optional.from(win['visualViewport']); - }; - var bounds = function (x, y, width, height) { - return { - x: x, - y: y, - width: width, - height: height, - right: x + width, - bottom: y + height - }; - }; - var getBounds = function (_win) { - var win = _win === undefined ? window : _win; - var doc = win.document; - var scroll = get$9(SugarElement.fromDom(doc)); - return get$a(win).fold(function () { - var html = win.document.documentElement; - var width = html.clientWidth; - var height = html.clientHeight; - return bounds(scroll.left, scroll.top, width, height); - }, function (visualViewport) { - return bounds(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height); - }); - }; - - var walkUp = function (navigation, doc) { - var frame = navigation.view(doc); - return frame.fold(constant([]), function (f) { - var parent = navigation.owner(f); - var rest = walkUp(navigation, parent); - return [f].concat(rest); - }); - }; - var pathTo = function (element, navigation) { - var d = navigation.owner(element); - var paths = walkUp(navigation, d); - return Optional.some(paths); - }; - - var view = function (doc) { - var _a; - var element = doc.dom === document ? Optional.none() : Optional.from((_a = doc.dom.defaultView) === null || _a === void 0 ? void 0 : _a.frameElement); - return element.map(SugarElement.fromDom); - }; - var owner$1 = function (element) { - return owner(element); - }; - - var Navigation = /*#__PURE__*/Object.freeze({ - __proto__: null, - view: view, - owner: owner$1 - }); - - var find$3 = function (element) { - var doc = SugarElement.fromDom(document); - var scroll = get$9(doc); - var path = pathTo(element, Navigation); - return path.fold(curry(absolute, element), function (frames) { - var offset = viewport(element); - var r = foldr(frames, function (b, a) { - var loc = viewport(a); - return { - left: b.left + loc.left, - top: b.top + loc.top - }; - }, { - left: 0, - top: 0 - }); - return SugarPosition(r.left + offset.left + scroll.left, r.top + offset.top + scroll.top); - }); - }; - - var pointed = function (point, width, height) { - return { - point: point, - width: width, - height: height - }; - }; - var rect = function (x, y, width, height) { - return { - x: x, - y: y, - width: width, - height: height - }; - }; - var bounds$1 = function (x, y, width, height) { - return { - x: x, - y: y, - width: width, - height: height, - right: x + width, - bottom: y + height - }; - }; - var box = function (element) { - var xy = absolute(element); - var w = getOuter$2(element); - var h = getOuter$1(element); - return bounds$1(xy.left, xy.top, w, h); - }; - var absolute$1 = function (element) { - var position = find$3(element); - var width = getOuter$2(element); - var height = getOuter$1(element); - return bounds$1(position.left, position.top, width, height); - }; - var win = function () { - return getBounds(window); - }; - - function ClosestOrAncestor (is, ancestor, scope, a, isRoot) { - if (is(scope, a)) { - return Optional.some(scope); - } else if (isFunction(isRoot) && isRoot(scope)) { - return Optional.none(); - } else { - return ancestor(scope, a, isRoot); - } - } - - var ancestor$1 = function (scope, predicate, isRoot) { - var element = scope.dom; - var stop = isFunction(isRoot) ? isRoot : never; - while (element.parentNode) { - element = element.parentNode; - var el = SugarElement.fromDom(element); - if (predicate(el)) { - return Optional.some(el); - } else if (stop(el)) { - break; - } - } - return Optional.none(); - }; - var closest$1 = function (scope, predicate, isRoot) { - var is = function (s, test) { - return test(s); - }; - return ClosestOrAncestor(is, ancestor$1, scope, predicate, isRoot); - }; - var descendant = function (scope, predicate) { - var descend = function (node) { - for (var i = 0; i < node.childNodes.length; i++) { - var child_1 = SugarElement.fromDom(node.childNodes[i]); - if (predicate(child_1)) { - return Optional.some(child_1); - } - var res = descend(node.childNodes[i]); - if (res.isSome()) { - return res; - } - } - return Optional.none(); - }; - return descend(scope.dom); - }; - - var closest$2 = function (scope, predicate, isRoot) { - return closest$1(scope, predicate, isRoot).isSome(); - }; - - var ancestor$2 = function (scope, selector, isRoot) { - return ancestor$1(scope, function (e) { - return is(e, selector); - }, isRoot); - }; - var descendant$1 = function (scope, selector) { - return one(selector, scope); - }; - var closest$3 = function (scope, selector, isRoot) { - var is$1 = function (element, selector) { - return is(element, selector); - }; - return ClosestOrAncestor(is$1, ancestor$2, scope, selector, isRoot); - }; - - var find$4 = function (queryElem) { - var dependent = closest$1(queryElem, function (elem) { - if (!isElement(elem)) { - return false; - } - var id = get$3(elem, 'id'); - return id !== undefined && id.indexOf('aria-owns') > -1; - }); - return dependent.bind(function (dep) { - var id = get$3(dep, 'id'); - var dos = getRootNode(dep); - return descendant$1(dos, '[aria-owns="' + id + '"]'); - }); - }; - var manager = function () { - var ariaId = generate$1('aria-owns'); - var link = function (elem) { - set$1(elem, 'aria-owns', ariaId); - }; - var unlink = function (elem) { - remove$1(elem, 'aria-owns'); - }; - return { - id: ariaId, - link: link, - unlink: unlink - }; - }; - - var isAriaPartOf = function (component, queryElem) { - return find$4(queryElem).exists(function (owner) { - return isPartOf(component, owner); - }); - }; - var isPartOf = function (component, queryElem) { - return closest$2(queryElem, function (el) { - return eq$1(el, component.element); - }, never) || isAriaPartOf(component, queryElem); - }; - - var unknown$3 = 'unknown'; - var EventConfiguration; - (function (EventConfiguration) { - EventConfiguration[EventConfiguration['STOP'] = 0] = 'STOP'; - EventConfiguration[EventConfiguration['NORMAL'] = 1] = 'NORMAL'; - EventConfiguration[EventConfiguration['LOGGING'] = 2] = 'LOGGING'; - }(EventConfiguration || (EventConfiguration = {}))); - var eventConfig = Cell({}); - var makeEventLogger = function (eventName, initialTarget) { - var sequence = []; - var startTime = new Date().getTime(); - return { - logEventCut: function (_name, target, purpose) { - sequence.push({ - outcome: 'cut', - target: target, - purpose: purpose - }); - }, - logEventStopped: function (_name, target, purpose) { - sequence.push({ - outcome: 'stopped', - target: target, - purpose: purpose - }); - }, - logNoParent: function (_name, target, purpose) { - sequence.push({ - outcome: 'no-parent', - target: target, - purpose: purpose - }); - }, - logEventNoHandlers: function (_name, target) { - sequence.push({ - outcome: 'no-handlers-left', - target: target - }); - }, - logEventResponse: function (_name, target, purpose) { - sequence.push({ - outcome: 'response', - purpose: purpose, - target: target - }); - }, - write: function () { - var finishTime = new Date().getTime(); - if (contains([ - 'mousemove', - 'mouseover', - 'mouseout', - systemInit() - ], eventName)) { - return; - } - console.log(eventName, { - event: eventName, - time: finishTime - startTime, - target: initialTarget.dom, - sequence: map(sequence, function (s) { - if (!contains([ - 'cut', - 'stopped', - 'response' - ], s.outcome)) { - return s.outcome; - } else { - return '{' + s.purpose + '} ' + s.outcome + ' at (' + element(s.target) + ')'; - } - }) - }); - } - }; - }; - var processEvent = function (eventName, initialTarget, f) { - var status = get$1(eventConfig.get(), eventName).orThunk(function () { - var patterns = keys(eventConfig.get()); - return findMap(patterns, function (p) { - return eventName.indexOf(p) > -1 ? Optional.some(eventConfig.get()[p]) : Optional.none(); - }); - }).getOr(EventConfiguration.NORMAL); - switch (status) { - case EventConfiguration.NORMAL: - return f(noLogger()); - case EventConfiguration.LOGGING: { - var logger = makeEventLogger(eventName, initialTarget); - var output = f(logger); - logger.write(); - return output; - } - case EventConfiguration.STOP: - return true; - } - }; - var path = [ - 'alloy/data/Fields', - 'alloy/debugging/Debugging' - ]; - var getTrace = function () { - var err = new Error(); - if (err.stack !== undefined) { - var lines = err.stack.split('\n'); - return find(lines, function (line) { - return line.indexOf('alloy') > 0 && !exists(path, function (p) { - return line.indexOf(p) > -1; - }); - }).getOr(unknown$3); - } else { - return unknown$3; - } - }; - var ignoreEvent = { - logEventCut: noop, - logEventStopped: noop, - logNoParent: noop, - logEventNoHandlers: noop, - logEventResponse: noop, - write: noop - }; - var monitorEvent = function (eventName, initialTarget, f) { - return processEvent(eventName, initialTarget, f); - }; - var noLogger = constant(ignoreEvent); - - var menuFields = constant([ - strict$1('menu'), - strict$1('selectedMenu') - ]); - var itemFields = constant([ - strict$1('item'), - strict$1('selectedItem') - ]); - var schema = constant(objOf(itemFields().concat(menuFields()))); - var itemSchema = constant(objOf(itemFields())); - - var _initSize = strictObjOf('initSize', [ - strict$1('numColumns'), - strict$1('numRows') - ]); - var itemMarkers = function () { - return strictOf('markers', itemSchema()); - }; - var tieredMenuMarkers = function () { - return strictObjOf('markers', [strict$1('backgroundMenu')].concat(menuFields()).concat(itemFields())); - }; - var markers = function (required) { - return strictObjOf('markers', map(required, strict$1)); - }; - var onPresenceHandler = function (label, fieldName, presence) { - var trace = getTrace(); - return field(fieldName, fieldName, presence, valueOf(function (f) { - return Result.value(function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return f.apply(undefined, args); - }); - })); - }; - var onHandler = function (fieldName) { - return onPresenceHandler('onHandler', fieldName, defaulted(noop)); - }; - var onKeyboardHandler = function (fieldName) { - return onPresenceHandler('onKeyboardHandler', fieldName, defaulted(Optional.none)); - }; - var onStrictHandler = function (fieldName) { - return onPresenceHandler('onHandler', fieldName, strict()); - }; - var onStrictKeyboardHandler = function (fieldName) { - return onPresenceHandler('onKeyboardHandler', fieldName, strict()); - }; - var output = function (name, value) { - return state$1(name, constant(value)); - }; - var snapshot = function (name) { - return state$1(name, identity); - }; - var initSize = constant(_initSize); - - var nu$7 = function (x, y, bubble, direction, boundsRestriction, label) { - return { - x: x, - y: y, - bubble: bubble, - direction: direction, - boundsRestriction: boundsRestriction, - label: label - }; - }; - - var adt$2 = Adt.generate([ - { southeast: [] }, - { southwest: [] }, - { northeast: [] }, - { northwest: [] }, - { south: [] }, - { north: [] }, - { east: [] }, - { west: [] } - ]); - var cata = function (subject, southeast, southwest, northeast, northwest, south, north, east, west) { - return subject.fold(southeast, southwest, northeast, northwest, south, north, east, west); - }; - var cataVertical = function (subject, south, middle, north) { - return subject.fold(south, south, north, north, south, north, middle, middle); - }; - var cataHorizontal = function (subject, east, middle, west) { - return subject.fold(east, west, east, west, middle, middle, east, west); - }; - var southeast = adt$2.southeast; - var southwest = adt$2.southwest; - var northeast = adt$2.northeast; - var northwest = adt$2.northwest; - var south = adt$2.south; - var north = adt$2.north; - var east = adt$2.east; - var west = adt$2.west; - - var getRestriction = function (anchor, restriction) { - switch (restriction) { - case 1: - return anchor.x; - case 0: - return anchor.x + anchor.width; - case 2: - return anchor.y; - case 3: - return anchor.y + anchor.height; - } - }; - var boundsRestriction = function (anchor, restrictions) { - return mapToObject([ - 'left', - 'right', - 'top', - 'bottom' - ], function (dir) { - return get$1(restrictions, dir).map(function (restriction) { - return getRestriction(anchor, restriction); - }); - }); - }; - var adjustBounds = function (bounds, boundsRestrictions, bubbleOffsets) { - var applyRestriction = function (dir, current) { - var bubbleOffset = dir === 'top' || dir === 'bottom' ? bubbleOffsets.top : bubbleOffsets.left; - return get$1(boundsRestrictions, dir).bind(identity).bind(function (restriction) { - if (dir === 'left' || dir === 'top') { - return restriction >= current ? Optional.some(restriction) : Optional.none(); - } else { - return restriction <= current ? Optional.some(restriction) : Optional.none(); - } - }).map(function (restriction) { - return restriction + bubbleOffset; - }).getOr(current); - }; - var adjustedLeft = applyRestriction('left', bounds.x); - var adjustedTop = applyRestriction('top', bounds.y); - var adjustedRight = applyRestriction('right', bounds.right); - var adjustedBottom = applyRestriction('bottom', bounds.bottom); - return bounds$1(adjustedLeft, adjustedTop, adjustedRight - adjustedLeft, adjustedBottom - adjustedTop); - }; - - var eastX = function (anchor) { - return anchor.x; - }; - var middleX = function (anchor, element) { - return anchor.x + anchor.width / 2 - element.width / 2; - }; - var westX = function (anchor, element) { - return anchor.x + anchor.width - element.width; - }; - var northY = function (anchor, element) { - return anchor.y - element.height; - }; - var southY = function (anchor) { - return anchor.y + anchor.height; - }; - var centreY = function (anchor, element) { - return anchor.y + anchor.height / 2 - element.height / 2; - }; - var eastEdgeX = function (anchor) { - return anchor.x + anchor.width; - }; - var westEdgeX = function (anchor, element) { - return anchor.x - element.width; - }; - var southeast$1 = function (anchor, element, bubbles) { - return nu$7(eastX(anchor), southY(anchor), bubbles.southeast(), southeast(), boundsRestriction(anchor, { - left: 1, - top: 3 - }), 'layout-se'); - }; - var southwest$1 = function (anchor, element, bubbles) { - return nu$7(westX(anchor, element), southY(anchor), bubbles.southwest(), southwest(), boundsRestriction(anchor, { - right: 0, - top: 3 - }), 'layout-sw'); - }; - var northeast$1 = function (anchor, element, bubbles) { - return nu$7(eastX(anchor), northY(anchor, element), bubbles.northeast(), northeast(), boundsRestriction(anchor, { - left: 1, - bottom: 2 - }), 'layout-ne'); - }; - var northwest$1 = function (anchor, element, bubbles) { - return nu$7(westX(anchor, element), northY(anchor, element), bubbles.northwest(), northwest(), boundsRestriction(anchor, { - right: 0, - bottom: 2 - }), 'layout-nw'); - }; - var north$1 = function (anchor, element, bubbles) { - return nu$7(middleX(anchor, element), northY(anchor, element), bubbles.north(), north(), boundsRestriction(anchor, { bottom: 2 }), 'layout-n'); - }; - var south$1 = function (anchor, element, bubbles) { - return nu$7(middleX(anchor, element), southY(anchor), bubbles.south(), south(), boundsRestriction(anchor, { top: 3 }), 'layout-s'); - }; - var east$1 = function (anchor, element, bubbles) { - return nu$7(eastEdgeX(anchor), centreY(anchor, element), bubbles.east(), east(), boundsRestriction(anchor, { left: 0 }), 'layout-e'); - }; - var west$1 = function (anchor, element, bubbles) { - return nu$7(westEdgeX(anchor, element), centreY(anchor, element), bubbles.west(), west(), boundsRestriction(anchor, { right: 1 }), 'layout-w'); - }; - var all$2 = function () { - return [ - southeast$1, - southwest$1, - northeast$1, - northwest$1, - south$1, - north$1, - east$1, - west$1 - ]; - }; - var allRtl = function () { - return [ - southwest$1, - southeast$1, - northwest$1, - northeast$1, - south$1, - north$1, - east$1, - west$1 - ]; - }; - var aboveOrBelow = function () { - return [ - northeast$1, - northwest$1, - southeast$1, - southwest$1, - north$1, - south$1 - ]; - }; - var aboveOrBelowRtl = function () { - return [ - northwest$1, - northeast$1, - southwest$1, - southeast$1, - north$1, - south$1 - ]; - }; - var belowOrAbove = function () { - return [ - southeast$1, - southwest$1, - northeast$1, - northwest$1, - south$1, - north$1 - ]; - }; - var belowOrAboveRtl = function () { - return [ - southwest$1, - southeast$1, - northwest$1, - northeast$1, - south$1, - north$1 - ]; - }; - - var chooseChannels = function (channels, message) { - return message.universal ? channels : filter(channels, function (ch) { - return contains(message.channels, ch); - }); - }; - var events$1 = function (receiveConfig) { - return derive([run(receive(), function (component, message) { - var channelMap = receiveConfig.channels; - var channels = keys(channelMap); - var receivingData = message; - var targetChannels = chooseChannels(channels, receivingData); - each(targetChannels, function (ch) { - var channelInfo = channelMap[ch]; - var channelSchema = channelInfo.schema; - var data = asRawOrDie('channel[' + ch + '] data\nReceiver: ' + element(component.element), channelSchema, receivingData.data); - channelInfo.onReceive(component, data); - }); - })]); - }; - - var ActiveReceiving = /*#__PURE__*/Object.freeze({ - __proto__: null, - events: events$1 - }); - - var ReceivingSchema = [strictOf('channels', setOf$1(Result.value, objOfOnly([ - onStrictHandler('onReceive'), - defaulted$1('schema', anyValue$1()) - ])))]; - - var executeEvent = function (bConfig, bState, executor) { - return runOnExecute(function (component) { - executor(component, bConfig, bState); - }); - }; - var loadEvent = function (bConfig, bState, f) { - return runOnInit(function (component, _simulatedEvent) { - f(component, bConfig, bState); - }); - }; - var create = function (schema, name, active, apis, extra, state) { - var configSchema = objOfOnly(schema); - var schemaSchema = optionObjOf(name, [optionObjOfOnly('config', schema)]); - return doCreate(configSchema, schemaSchema, name, active, apis, extra, state); - }; - var createModes = function (modes, name, active, apis, extra, state) { - var configSchema = modes; - var schemaSchema = optionObjOf(name, [optionOf('config', modes)]); - return doCreate(configSchema, schemaSchema, name, active, apis, extra, state); - }; - var wrapApi = function (bName, apiFunction, apiName) { - var f = function (component) { - var rest = []; - for (var _i = 1; _i < arguments.length; _i++) { - rest[_i - 1] = arguments[_i]; - } - var args = [component].concat(rest); - return component.config({ name: constant(bName) }).fold(function () { - throw new Error('We could not find any behaviour configuration for: ' + bName + '. Using API: ' + apiName); - }, function (info) { - var rest = Array.prototype.slice.call(args, 1); - return apiFunction.apply(undefined, [ - component, - info.config, - info.state - ].concat(rest)); - }); - }; - return markAsBehaviourApi(f, apiName, apiFunction); - }; - var revokeBehaviour = function (name) { - return { - key: name, - value: undefined - }; - }; - var doCreate = function (configSchema, schemaSchema, name, active, apis, extra, state) { - var getConfig = function (info) { - return hasNonNullableKey(info, name) ? info[name]() : Optional.none(); - }; - var wrappedApis = map$2(apis, function (apiF, apiName) { - return wrapApi(name, apiF, apiName); - }); - var wrappedExtra = map$2(extra, function (extraF, extraName) { - return markAsExtraApi(extraF, extraName); - }); - var me = __assign(__assign(__assign({}, wrappedExtra), wrappedApis), { - revoke: curry(revokeBehaviour, name), - config: function (spec) { - var prepared = asRawOrDie(name + '-config', configSchema, spec); - return { - key: name, - value: { - config: prepared, - me: me, - configAsRaw: cached(function () { - return asRawOrDie(name + '-config', configSchema, spec); - }), - initialConfig: spec, - state: state - } - }; - }, - schema: constant(schemaSchema), - exhibit: function (info, base) { - return getConfig(info).bind(function (behaviourInfo) { - return get$1(active, 'exhibit').map(function (exhibitor) { - return exhibitor(base, behaviourInfo.config, behaviourInfo.state); - }); - }).getOr(nu$6({})); - }, - name: constant(name), - handlers: function (info) { - return getConfig(info).map(function (behaviourInfo) { - var getEvents = get$1(active, 'events').getOr(function () { - return {}; - }); - return getEvents(behaviourInfo.config, behaviourInfo.state); - }).getOr({}); - } - }); - return me; - }; - - var derive$1 = function (capabilities) { - return wrapAll$1(capabilities); - }; - var simpleSchema = objOfOnly([ - strict$1('fields'), - strict$1('name'), - defaulted$1('active', {}), - defaulted$1('apis', {}), - defaulted$1('state', NoState), - defaulted$1('extra', {}) - ]); - var create$1 = function (data) { - var value = asRawOrDie('Creating behaviour: ' + data.name, simpleSchema, data); - return create(value.fields, value.name, value.active, value.apis, value.extra, value.state); - }; - var modeSchema = objOfOnly([ - strict$1('branchKey'), - strict$1('branches'), - strict$1('name'), - defaulted$1('active', {}), - defaulted$1('apis', {}), - defaulted$1('state', NoState), - defaulted$1('extra', {}) - ]); - var createModes$1 = function (data) { - var value = asRawOrDie('Creating behaviour: ' + data.name, modeSchema, data); - return createModes(choose$1(value.branchKey, value.branches), value.name, value.active, value.apis, value.extra, value.state); - }; - var revoke = constant(undefined); - - var Receiving = create$1({ - fields: ReceivingSchema, - name: 'receiving', - active: ActiveReceiving - }); - - var exhibit = function (base, posConfig) { - return nu$6({ - classes: [], - styles: posConfig.useFixed() ? {} : { position: 'relative' } - }); - }; - - var ActivePosition = /*#__PURE__*/Object.freeze({ - __proto__: null, - exhibit: exhibit - }); - - var getDocument = function () { - return SugarElement.fromDom(document); - }; - - var focus$1 = function (element) { - return element.dom.focus(); - }; - var blur = function (element) { - return element.dom.blur(); - }; - var hasFocus = function (element) { - var root = getRootNode(element).dom; - return element.dom === root.activeElement; - }; - var active = function (root) { - if (root === void 0) { - root = getDocument(); - } - return Optional.from(root.dom.activeElement).map(SugarElement.fromDom); - }; - var search = function (element) { - return active(getRootNode(element)).filter(function (e) { - return element.dom.contains(e.dom); - }); - }; - - var preserve = function (f, container) { - var dos = getRootNode(container); - var refocus = active(dos).bind(function (focused) { - var hasFocus = function (elem) { - return eq$1(focused, elem); - }; - return hasFocus(container) ? Optional.some(container) : descendant(container, hasFocus); - }); - var result = f(container); - refocus.each(function (oldFocus) { - active(dos).filter(function (newFocus) { - return eq$1(newFocus, oldFocus); - }).fold(function () { - focus$1(oldFocus); - }, noop); - }); - return result; - }; - - var NuPositionCss = function (position, left, top, right, bottom) { - return { - position: position, - left: left, - top: top, - right: right, - bottom: bottom - }; - }; - var applyPositionCss = function (element, position) { - var addPx = function (num) { - return num + 'px'; - }; - setOptions(element, { - position: Optional.some(position.position), - left: position.left.map(addPx), - top: position.top.map(addPx), - right: position.right.map(addPx), - bottom: position.bottom.map(addPx) - }); - }; - - var adt$3 = Adt.generate([ - { none: [] }, - { - relative: [ - 'x', - 'y', - 'width', - 'height' - ] - }, - { - fixed: [ - 'x', - 'y', - 'width', - 'height' - ] - } - ]); - var positionWithDirection = function (posName, decision, x, y, width, height) { - var decisionX = decision.x - x; - var decisionY = decision.y - y; - var decisionWidth = decision.width; - var decisionHeight = decision.height; - var decisionRight = width - (decisionX + decisionWidth); - var decisionBottom = height - (decisionY + decisionHeight); - var left = Optional.some(decisionX); - var top = Optional.some(decisionY); - var right = Optional.some(decisionRight); - var bottom = Optional.some(decisionBottom); - var none = Optional.none(); - return cata(decision.direction, function () { - return NuPositionCss(posName, left, top, none, none); - }, function () { - return NuPositionCss(posName, none, top, right, none); - }, function () { - return NuPositionCss(posName, left, none, none, bottom); - }, function () { - return NuPositionCss(posName, none, none, right, bottom); - }, function () { - return NuPositionCss(posName, left, top, none, none); - }, function () { - return NuPositionCss(posName, left, none, none, bottom); - }, function () { - return NuPositionCss(posName, left, top, none, none); - }, function () { - return NuPositionCss(posName, none, top, right, none); - }); - }; - var reposition = function (origin, decision) { - return origin.fold(function () { - return NuPositionCss('absolute', Optional.some(decision.x), Optional.some(decision.y), Optional.none(), Optional.none()); - }, function (x, y, width, height) { - return positionWithDirection('absolute', decision, x, y, width, height); - }, function (x, y, width, height) { - return positionWithDirection('fixed', decision, x, y, width, height); - }); - }; - var toBox = function (origin, element) { - var rel = curry(find$3, element); - var position = origin.fold(rel, rel, function () { - var scroll = get$9(); - return find$3(element).translate(-scroll.left, -scroll.top); - }); - var width = getOuter$2(element); - var height = getOuter$1(element); - return bounds$1(position.left, position.top, width, height); - }; - var viewport$1 = function (origin, getBounds) { - return getBounds.fold(function () { - return origin.fold(win, win, bounds$1); - }, function (b) { - return origin.fold(b, b, function () { - var bounds = b(); - var pos = translate(origin, bounds.x, bounds.y); - return bounds$1(pos.left, pos.top, bounds.width, bounds.height); - }); - }); - }; - var translate = function (origin, x, y) { - var pos = SugarPosition(x, y); - var removeScroll = function () { - var outerScroll = get$9(); - return pos.translate(-outerScroll.left, -outerScroll.top); - }; - return origin.fold(constant(pos), constant(pos), removeScroll); - }; - var cata$1 = function (subject, onNone, onRelative, onFixed) { - return subject.fold(onNone, onRelative, onFixed); - }; - var none$1 = adt$3.none; - var relative = adt$3.relative; - var fixed = adt$3.fixed; - - var anchor = function (anchorBox, origin) { - return { - anchorBox: anchorBox, - origin: origin - }; - }; - var box$1 = function (anchorBox, origin) { - return anchor(anchorBox, origin); - }; - - var cycleBy = function (value, delta, min, max) { - var r = value + delta; - if (r > max) { - return min; - } else if (r < min) { - return max; - } else { - return r; - } - }; - var clamp = function (value, min, max) { - return Math.min(Math.max(value, min), max); - }; - - var adt$4 = Adt.generate([ - { fit: ['reposition'] }, - { - nofit: [ - 'reposition', - 'deltaW', - 'deltaH' - ] - } - ]); - var calcReposition = function (newX, newY, width, height, bounds) { - var boundsX = bounds.x; - var boundsY = bounds.y; - var boundsWidth = bounds.width; - var boundsHeight = bounds.height; - var xInBounds = newX >= boundsX; - var yInBounds = newY >= boundsY; - var originInBounds = xInBounds && yInBounds; - var xFit = newX + width <= boundsX + boundsWidth; - var yFit = newY + height <= boundsY + boundsHeight; - var sizeInBounds = xFit && yFit; - var deltaW = Math.abs(Math.min(width, xInBounds ? boundsX + boundsWidth - newX : boundsX - (newX + width))); - var deltaH = Math.abs(Math.min(height, yInBounds ? boundsY + boundsHeight - newY : boundsY - (newY + height))); - var maxX = Math.max(bounds.x, bounds.right - width); - var maxY = Math.max(bounds.y, bounds.bottom - height); - var limitX = clamp(newX, bounds.x, maxX); - var limitY = clamp(newY, bounds.y, maxY); - return { - originInBounds: originInBounds, - sizeInBounds: sizeInBounds, - limitX: limitX, - limitY: limitY, - deltaW: deltaW, - deltaH: deltaH - }; - }; - var attempt = function (candidate, width, height, bounds) { - var candidateX = candidate.x; - var candidateY = candidate.y; - var bubbleOffsets = candidate.bubble.offset; - var bubbleLeft = bubbleOffsets.left; - var bubbleTop = bubbleOffsets.top; - var adjustedBounds = adjustBounds(bounds, candidate.boundsRestriction, bubbleOffsets); - var boundsY = adjustedBounds.y; - var boundsBottom = adjustedBounds.bottom; - var boundsX = adjustedBounds.x; - var boundsRight = adjustedBounds.right; - var newX = candidateX + bubbleLeft; - var newY = candidateY + bubbleTop; - var _a = calcReposition(newX, newY, width, height, adjustedBounds), originInBounds = _a.originInBounds, sizeInBounds = _a.sizeInBounds, limitX = _a.limitX, limitY = _a.limitY, deltaW = _a.deltaW, deltaH = _a.deltaH; - var upAvailable = constant(limitY + deltaH - boundsY); - var downAvailable = constant(boundsBottom - limitY); - var maxHeight = cataVertical(candidate.direction, downAvailable, downAvailable, upAvailable); - var westAvailable = constant(limitX + deltaW - boundsX); - var eastAvailable = constant(boundsRight - limitX); - var maxWidth = cataHorizontal(candidate.direction, eastAvailable, eastAvailable, westAvailable); - var reposition = { - x: limitX, - y: limitY, - width: deltaW, - height: deltaH, - maxHeight: maxHeight, - maxWidth: maxWidth, - direction: candidate.direction, - classes: { - on: candidate.bubble.classesOn, - off: candidate.bubble.classesOff - }, - label: candidate.label, - candidateYforTest: newY - }; - return originInBounds && sizeInBounds ? adt$4.fit(reposition) : adt$4.nofit(reposition, deltaW, deltaH); - }; - var attempts = function (candidates, anchorBox, elementBox, bubbles, bounds) { - var panelWidth = elementBox.width; - var panelHeight = elementBox.height; - var attemptBestFit = function (layout, reposition, deltaW, deltaH) { - var next = layout(anchorBox, elementBox, bubbles); - var attemptLayout = attempt(next, panelWidth, panelHeight, bounds); - return attemptLayout.fold(adt$4.fit, function (newReposition, newDeltaW, newDeltaH) { - var improved = newDeltaH > deltaH || newDeltaW > deltaW; - return improved ? adt$4.nofit(newReposition, newDeltaW, newDeltaH) : adt$4.nofit(reposition, deltaW, deltaH); - }); - }; - var abc = foldl(candidates, function (b, a) { - var bestNext = curry(attemptBestFit, a); - return b.fold(adt$4.fit, bestNext); - }, adt$4.nofit({ - x: anchorBox.x, - y: anchorBox.y, - width: elementBox.width, - height: elementBox.height, - maxHeight: elementBox.height, - maxWidth: elementBox.width, - direction: southeast(), - classes: { - on: [], - off: [] - }, - label: 'none', - candidateYforTest: anchorBox.y - }, -1, -1)); - return abc.fold(identity, identity); - }; - - var elementSize = function (p) { - return { - width: getOuter$2(p), - height: getOuter$1(p) - }; - }; - var layout = function (anchorBox, element, bubbles, options) { - remove$6(element, 'max-height'); - remove$6(element, 'max-width'); - var elementBox = elementSize(element); - return attempts(options.preference, anchorBox, elementBox, bubbles, options.bounds); - }; - var setClasses = function (element, decision) { - var classInfo = decision.classes; - remove$5(element, classInfo.off); - add$3(element, classInfo.on); - }; - var setHeight = function (element, decision, options) { - var maxHeightFunction = options.maxHeightFunction; - maxHeightFunction(element, decision.maxHeight); - }; - var setWidth = function (element, decision, options) { - var maxWidthFunction = options.maxWidthFunction; - maxWidthFunction(element, decision.maxWidth); - }; - var position = function (element, decision, options) { - applyPositionCss(element, reposition(options.origin, decision)); - }; - - var setMaxHeight = function (element, maxHeight) { - setMax(element, Math.floor(maxHeight)); - }; - var anchored = constant(function (element, available) { - setMaxHeight(element, available); - setAll$1(element, { - 'overflow-x': 'hidden', - 'overflow-y': 'auto' - }); - }); - var expandable = constant(function (element, available) { - setMaxHeight(element, available); - }); - - var defaultOr = function (options, key, dephault) { - return options[key] === undefined ? dephault : options[key]; - }; - var simple = function (anchor, element, bubble, layouts, getBounds, overrideOptions) { - var maxHeightFunction = defaultOr(overrideOptions, 'maxHeightFunction', anchored()); - var maxWidthFunction = defaultOr(overrideOptions, 'maxWidthFunction', noop); - var anchorBox = anchor.anchorBox; - var origin = anchor.origin; - var options = { - bounds: viewport$1(origin, getBounds), - origin: origin, - preference: layouts, - maxHeightFunction: maxHeightFunction, - maxWidthFunction: maxWidthFunction - }; - go(anchorBox, element, bubble, options); - }; - var go = function (anchorBox, element, bubble, options) { - var decision = layout(anchorBox, element, bubble, options); - position(element, decision, options); - setClasses(element, decision); - setHeight(element, decision, options); - setWidth(element, decision, options); - }; - - var allAlignments = [ - 'valignCentre', - 'alignLeft', - 'alignRight', - 'alignCentre', - 'top', - 'bottom', - 'left', - 'right' - ]; - var nu$8 = function (width, yoffset, classes) { - var getClasses = function (prop) { - return get$1(classes, prop).getOr([]); - }; - var make = function (xDelta, yDelta, alignmentsOn) { - var alignmentsOff = difference(allAlignments, alignmentsOn); - return { - offset: SugarPosition(xDelta, yDelta), - classesOn: bind(alignmentsOn, getClasses), - classesOff: bind(alignmentsOff, getClasses) - }; - }; - return { - southeast: function () { - return make(-width, yoffset, [ - 'top', - 'alignLeft' - ]); - }, - southwest: function () { - return make(width, yoffset, [ - 'top', - 'alignRight' - ]); - }, - south: function () { - return make(-width / 2, yoffset, [ - 'top', - 'alignCentre' - ]); - }, - northeast: function () { - return make(-width, -yoffset, [ - 'bottom', - 'alignLeft' - ]); - }, - northwest: function () { - return make(width, -yoffset, [ - 'bottom', - 'alignRight' - ]); - }, - north: function () { - return make(-width / 2, -yoffset, [ - 'bottom', - 'alignCentre' - ]); - }, - east: function () { - return make(width, -yoffset / 2, [ - 'valignCentre', - 'left' - ]); - }, - west: function () { - return make(-width, -yoffset / 2, [ - 'valignCentre', - 'right' - ]); - }, - innerNorthwest: function () { - return make(-width, yoffset, [ - 'top', - 'alignRight' - ]); - }, - innerNortheast: function () { - return make(width, yoffset, [ - 'top', - 'alignLeft' - ]); - }, - innerNorth: function () { - return make(-width / 2, yoffset, [ - 'top', - 'alignCentre' - ]); - }, - innerSouthwest: function () { - return make(-width, -yoffset, [ - 'bottom', - 'alignRight' - ]); - }, - innerSoutheast: function () { - return make(width, -yoffset, [ - 'bottom', - 'alignLeft' - ]); - }, - innerSouth: function () { - return make(-width / 2, -yoffset, [ - 'bottom', - 'alignCentre' - ]); - }, - innerWest: function () { - return make(width, -yoffset / 2, [ - 'valignCentre', - 'right' - ]); - }, - innerEast: function () { - return make(-width, -yoffset / 2, [ - 'valignCentre', - 'left' - ]); - } - }; - }; - var fallback = function () { - return nu$8(0, 0, {}); - }; - - var nu$9 = function (x) { - return x; - }; - - var onDirection = function (isLtr, isRtl) { - return function (element) { - return getDirection(element) === 'rtl' ? isRtl : isLtr; - }; - }; - var getDirection = function (element) { - return get$5(element, 'direction') === 'rtl' ? 'rtl' : 'ltr'; - }; - - var AttributeValue; - (function (AttributeValue) { - AttributeValue['TopToBottom'] = 'toptobottom'; - AttributeValue['BottomToTop'] = 'bottomtotop'; - }(AttributeValue || (AttributeValue = {}))); - var Attribute = 'data-alloy-vertical-dir'; - var isBottomToTopDir = function (el) { - return closest$2(el, function (current) { - return isElement(current) && get$3(current, 'data-alloy-vertical-dir') === AttributeValue.BottomToTop; - }); - }; - - var schema$1 = function () { - return optionObjOf('layouts', [ - strict$1('onLtr'), - strict$1('onRtl'), - option('onBottomLtr'), - option('onBottomRtl') - ]); - }; - var get$b = function (elem, info, defaultLtr, defaultRtl, defaultBottomLtr, defaultBottomRtl, dirElement) { - var isBottomToTop = dirElement.map(isBottomToTopDir).getOr(false); - var customLtr = info.layouts.map(function (ls) { - return ls.onLtr(elem); - }); - var customRtl = info.layouts.map(function (ls) { - return ls.onRtl(elem); - }); - var ltr = isBottomToTop ? info.layouts.bind(function (ls) { - return ls.onBottomLtr.map(function (f) { - return f(elem); - }); - }).or(customLtr).getOr(defaultBottomLtr) : customLtr.getOr(defaultLtr); - var rtl = isBottomToTop ? info.layouts.bind(function (ls) { - return ls.onBottomRtl.map(function (f) { - return f(elem); - }); - }).or(customRtl).getOr(defaultBottomRtl) : customRtl.getOr(defaultRtl); - var f = onDirection(ltr, rtl); - return f(elem); - }; - - var placement = function (component, anchorInfo, origin) { - var hotspot = anchorInfo.hotspot; - var anchorBox = toBox(origin, hotspot.element); - var layouts = get$b(component.element, anchorInfo, belowOrAbove(), belowOrAboveRtl(), aboveOrBelow(), aboveOrBelowRtl(), Optional.some(anchorInfo.hotspot.element)); - return Optional.some(nu$9({ - anchorBox: anchorBox, - bubble: anchorInfo.bubble.getOr(fallback()), - overrides: anchorInfo.overrides, - layouts: layouts, - placer: Optional.none() - })); - }; - var HotspotAnchor = [ - strict$1('hotspot'), - option('bubble'), - defaulted$1('overrides', {}), - schema$1(), - output('placement', placement) - ]; - - var placement$1 = function (component, anchorInfo, origin) { - var pos = translate(origin, anchorInfo.x, anchorInfo.y); - var anchorBox = bounds$1(pos.left, pos.top, anchorInfo.width, anchorInfo.height); - var layouts = get$b(component.element, anchorInfo, all$2(), allRtl(), all$2(), allRtl(), Optional.none()); - return Optional.some(nu$9({ - anchorBox: anchorBox, - bubble: anchorInfo.bubble, - overrides: anchorInfo.overrides, - layouts: layouts, - placer: Optional.none() - })); - }; - var MakeshiftAnchor = [ - strict$1('x'), - strict$1('y'), - defaulted$1('height', 0), - defaulted$1('width', 0), - defaulted$1('bubble', fallback()), - defaulted$1('overrides', {}), - schema$1(), - output('placement', placement$1) - ]; - - var adt$5 = Adt.generate([ - { screen: ['point'] }, - { - absolute: [ - 'point', - 'scrollLeft', - 'scrollTop' - ] - } - ]); - var toFixed = function (pos) { - return pos.fold(identity, function (point, scrollLeft, scrollTop) { - return point.translate(-scrollLeft, -scrollTop); - }); - }; - var toAbsolute = function (pos) { - return pos.fold(identity, identity); - }; - var sum = function (points) { - return foldl(points, function (b, a) { - return b.translate(a.left, a.top); - }, SugarPosition(0, 0)); - }; - var sumAsFixed = function (positions) { - var points = map(positions, toFixed); - return sum(points); - }; - var sumAsAbsolute = function (positions) { - var points = map(positions, toAbsolute); - return sum(points); - }; - var screen = adt$5.screen; - var absolute$2 = adt$5.absolute; - - var getOffset = function (component, origin, anchorInfo) { - var win = defaultView(anchorInfo.root).dom; - var hasSameOwner = function (frame) { - var frameOwner = owner(frame); - var compOwner = owner(component.element); - return eq$1(frameOwner, compOwner); - }; - return Optional.from(win.frameElement).map(SugarElement.fromDom).filter(hasSameOwner).map(absolute); - }; - var getRootPoint = function (component, origin, anchorInfo) { - var doc = owner(component.element); - var outerScroll = get$9(doc); - var offset = getOffset(component, origin, anchorInfo).getOr(outerScroll); - return absolute$2(offset, outerScroll.left, outerScroll.top); - }; - - var capRect = function (left, top, width, height) { - var newLeft = left, newTop = top, newWidth = width, newHeight = height; - if (left < 0) { - newLeft = 0; - newWidth = width + left; - } - if (top < 0) { - newTop = 0; - newHeight = height + top; - } - var point = screen(SugarPosition(newLeft, newTop)); - return Optional.some(pointed(point, newWidth, newHeight)); - }; - var calcNewAnchor = function (optBox, rootPoint, anchorInfo, origin, elem) { - return optBox.map(function (box) { - var points = [ - rootPoint, - box.point - ]; - var topLeft = cata$1(origin, function () { - return sumAsAbsolute(points); - }, function () { - return sumAsAbsolute(points); - }, function () { - return sumAsFixed(points); - }); - var anchorBox = rect(topLeft.left, topLeft.top, box.width, box.height); - var layoutsLtr = anchorInfo.showAbove ? aboveOrBelow() : belowOrAbove(); - var layoutsRtl = anchorInfo.showAbove ? aboveOrBelowRtl() : belowOrAboveRtl(); - var layouts = get$b(elem, anchorInfo, layoutsLtr, layoutsRtl, layoutsLtr, layoutsRtl, Optional.none()); - return nu$9({ - anchorBox: anchorBox, - bubble: anchorInfo.bubble.getOr(fallback()), - overrides: anchorInfo.overrides, - layouts: layouts, - placer: Optional.none() - }); - }); - }; - - var placement$2 = function (component, anchorInfo, origin) { - var rootPoint = getRootPoint(component, origin, anchorInfo); - return anchorInfo.node.filter(inBody).bind(function (target) { - var rect = target.dom.getBoundingClientRect(); - var nodeBox = capRect(rect.left, rect.top, rect.width, rect.height); - var elem = anchorInfo.node.getOr(component.element); - return calcNewAnchor(nodeBox, rootPoint, anchorInfo, origin, elem); - }); - }; - var NodeAnchor = [ - strict$1('node'), - strict$1('root'), - option('bubble'), - schema$1(), - defaulted$1('overrides', {}), - defaulted$1('showAbove', false), - output('placement', placement$2) - ]; - - var zeroWidth = '\uFEFF'; - var nbsp = '\xA0'; - - var create$2 = function (start, soffset, finish, foffset) { - return { - start: start, - soffset: soffset, - finish: finish, - foffset: foffset - }; - }; - var SimRange = { create: create$2 }; - - var adt$6 = Adt.generate([ - { before: ['element'] }, - { - on: [ - 'element', - 'offset' - ] - }, - { after: ['element'] } - ]); - var cata$2 = function (subject, onBefore, onOn, onAfter) { - return subject.fold(onBefore, onOn, onAfter); - }; - var getStart = function (situ) { - return situ.fold(identity, identity, identity); - }; - var before$2 = adt$6.before; - var on = adt$6.on; - var after$1 = adt$6.after; - var Situ = { - before: before$2, - on: on, - after: after$1, - cata: cata$2, - getStart: getStart - }; - - var adt$7 = Adt.generate([ - { domRange: ['rng'] }, - { - relative: [ - 'startSitu', - 'finishSitu' - ] - }, - { - exact: [ - 'start', - 'soffset', - 'finish', - 'foffset' - ] - } - ]); - var exactFromRange = function (simRange) { - return adt$7.exact(simRange.start, simRange.soffset, simRange.finish, simRange.foffset); - }; - var getStart$1 = function (selection) { - return selection.match({ - domRange: function (rng) { - return SugarElement.fromDom(rng.startContainer); - }, - relative: function (startSitu, _finishSitu) { - return Situ.getStart(startSitu); - }, - exact: function (start, _soffset, _finish, _foffset) { - return start; - } - }); - }; - var domRange = adt$7.domRange; - var relative$1 = adt$7.relative; - var exact = adt$7.exact; - var getWin = function (selection) { - var start = getStart$1(selection); - return defaultView(start); - }; - var range$1 = SimRange.create; - var SimSelection = { - domRange: domRange, - relative: relative$1, - exact: exact, - exactFromRange: exactFromRange, - getWin: getWin, - range: range$1 - }; - - var setStart = function (rng, situ) { - situ.fold(function (e) { - rng.setStartBefore(e.dom); - }, function (e, o) { - rng.setStart(e.dom, o); - }, function (e) { - rng.setStartAfter(e.dom); - }); - }; - var setFinish = function (rng, situ) { - situ.fold(function (e) { - rng.setEndBefore(e.dom); - }, function (e, o) { - rng.setEnd(e.dom, o); - }, function (e) { - rng.setEndAfter(e.dom); - }); - }; - var relativeToNative = function (win, startSitu, finishSitu) { - var range = win.document.createRange(); - setStart(range, startSitu); - setFinish(range, finishSitu); - return range; - }; - var exactToNative = function (win, start, soffset, finish, foffset) { - var rng = win.document.createRange(); - rng.setStart(start.dom, soffset); - rng.setEnd(finish.dom, foffset); - return rng; - }; - var toRect = function (rect) { - return { - left: rect.left, - top: rect.top, - right: rect.right, - bottom: rect.bottom, - width: rect.width, - height: rect.height - }; - }; - var getFirstRect = function (rng) { - var rects = rng.getClientRects(); - var rect = rects.length > 0 ? rects[0] : rng.getBoundingClientRect(); - return rect.width > 0 || rect.height > 0 ? Optional.some(rect).map(toRect) : Optional.none(); - }; - - var adt$8 = Adt.generate([ - { - ltr: [ - 'start', - 'soffset', - 'finish', - 'foffset' - ] - }, - { - rtl: [ - 'start', - 'soffset', - 'finish', - 'foffset' - ] - } - ]); - var fromRange = function (win, type, range) { - return type(SugarElement.fromDom(range.startContainer), range.startOffset, SugarElement.fromDom(range.endContainer), range.endOffset); - }; - var getRanges = function (win, selection) { - return selection.match({ - domRange: function (rng) { - return { - ltr: constant(rng), - rtl: Optional.none - }; - }, - relative: function (startSitu, finishSitu) { - return { - ltr: cached(function () { - return relativeToNative(win, startSitu, finishSitu); - }), - rtl: cached(function () { - return Optional.some(relativeToNative(win, finishSitu, startSitu)); - }) - }; - }, - exact: function (start, soffset, finish, foffset) { - return { - ltr: cached(function () { - return exactToNative(win, start, soffset, finish, foffset); - }), - rtl: cached(function () { - return Optional.some(exactToNative(win, finish, foffset, start, soffset)); - }) - }; - } - }); - }; - var doDiagnose = function (win, ranges) { - var rng = ranges.ltr(); - if (rng.collapsed) { - var reversed = ranges.rtl().filter(function (rev) { - return rev.collapsed === false; - }); - return reversed.map(function (rev) { - return adt$8.rtl(SugarElement.fromDom(rev.endContainer), rev.endOffset, SugarElement.fromDom(rev.startContainer), rev.startOffset); - }).getOrThunk(function () { - return fromRange(win, adt$8.ltr, rng); - }); - } else { - return fromRange(win, adt$8.ltr, rng); - } - }; - var diagnose = function (win, selection) { - var ranges = getRanges(win, selection); - return doDiagnose(win, ranges); - }; - var asLtrRange = function (win, selection) { - var diagnosis = diagnose(win, selection); - return diagnosis.match({ - ltr: function (start, soffset, finish, foffset) { - var rng = win.document.createRange(); - rng.setStart(start.dom, soffset); - rng.setEnd(finish.dom, foffset); - return rng; - }, - rtl: function (start, soffset, finish, foffset) { - var rng = win.document.createRange(); - rng.setStart(finish.dom, foffset); - rng.setEnd(start.dom, soffset); - return rng; - } - }); - }; - var ltr = adt$8.ltr; - var rtl = adt$8.rtl; - - var NodeValue = function (is, name) { - var get = function (element) { - if (!is(element)) { - throw new Error('Can only get ' + name + ' value of a ' + name + ' node'); - } - return getOption(element).getOr(''); - }; - var getOption = function (element) { - return is(element) ? Optional.from(element.dom.nodeValue) : Optional.none(); - }; - var set = function (element, value) { - if (!is(element)) { - throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node'); - } - element.dom.nodeValue = value; - }; - return { - get: get, - getOption: getOption, - set: set - }; - }; - - var api$2 = NodeValue(isText, 'text'); - var get$c = function (element) { - return api$2.get(element); - }; - var getOption = function (element) { - return api$2.getOption(element); - }; - - var getEnd = function (element) { - return name(element) === 'img' ? 1 : getOption(element).fold(function () { - return children(element).length; - }, function (v) { - return v.length; - }); - }; - var isTextNodeWithCursorPosition = function (el) { - return getOption(el).filter(function (text) { - return text.trim().length !== 0 || text.indexOf(nbsp) > -1; - }).isSome(); - }; - var elementsWithCursorPosition = [ - 'img', - 'br' - ]; - var isCursorPosition = function (elem) { - var hasCursorPosition = isTextNodeWithCursorPosition(elem); - return hasCursorPosition || contains(elementsWithCursorPosition, name(elem)); - }; - - var last$1 = function (element) { - return descendantRtl(element, isCursorPosition); - }; - var descendantRtl = function (scope, predicate) { - var descend = function (element) { - var children$1 = children(element); - for (var i = children$1.length - 1; i >= 0; i--) { - var child = children$1[i]; - if (predicate(child)) { - return Optional.some(child); - } - var res = descend(child); - if (res.isSome()) { - return res; - } - } - return Optional.none(); - }; - return descend(scope); - }; - - var descendants = function (scope, selector) { - return all(selector, scope); - }; - - var makeRange = function (start, soffset, finish, foffset) { - var doc = owner(start); - var rng = doc.dom.createRange(); - rng.setStart(start.dom, soffset); - rng.setEnd(finish.dom, foffset); - return rng; - }; - var after$2 = function (start, soffset, finish, foffset) { - var r = makeRange(start, soffset, finish, foffset); - var same = eq$1(start, finish) && soffset === foffset; - return r.collapsed && !same; - }; - - var getNativeSelection = function (win) { - return Optional.from(win.getSelection()); - }; - var readRange = function (selection) { - if (selection.rangeCount > 0) { - var firstRng = selection.getRangeAt(0); - var lastRng = selection.getRangeAt(selection.rangeCount - 1); - return Optional.some(SimRange.create(SugarElement.fromDom(firstRng.startContainer), firstRng.startOffset, SugarElement.fromDom(lastRng.endContainer), lastRng.endOffset)); - } else { - return Optional.none(); - } - }; - var doGetExact = function (selection) { - if (selection.anchorNode === null || selection.focusNode === null) { - return readRange(selection); - } else { - var anchor = SugarElement.fromDom(selection.anchorNode); - var focus_1 = SugarElement.fromDom(selection.focusNode); - return after$2(anchor, selection.anchorOffset, focus_1, selection.focusOffset) ? Optional.some(SimRange.create(anchor, selection.anchorOffset, focus_1, selection.focusOffset)) : readRange(selection); - } - }; - var getExact = function (win) { - return getNativeSelection(win).filter(function (sel) { - return sel.rangeCount > 0; - }).bind(doGetExact); - }; - var getFirstRect$1 = function (win, selection) { - var rng = asLtrRange(win, selection); - return getFirstRect(rng); - }; - - var point = function (element, offset) { - return { - element: element, - offset: offset - }; - }; - var descendOnce = function (element, offset) { - var children$1 = children(element); - if (children$1.length === 0) { - return point(element, offset); - } else if (offset < children$1.length) { - return point(children$1[offset], 0); - } else { - var last = children$1[children$1.length - 1]; - var len = isText(last) ? get$c(last).length : children(last).length; - return point(last, len); - } - }; - - var descendOnce$1 = function (element, offset) { - return isText(element) ? point(element, offset) : descendOnce(element, offset); - }; - var getAnchorSelection = function (win, anchorInfo) { - var getSelection = anchorInfo.getSelection.getOrThunk(function () { - return function () { - return getExact(win); - }; - }); - return getSelection().map(function (sel) { - var modStart = descendOnce$1(sel.start, sel.soffset); - var modFinish = descendOnce$1(sel.finish, sel.foffset); - return SimSelection.range(modStart.element, modStart.offset, modFinish.element, modFinish.offset); - }); - }; - var placement$3 = function (component, anchorInfo, origin) { - var win = defaultView(anchorInfo.root).dom; - var rootPoint = getRootPoint(component, origin, anchorInfo); - var selectionBox = getAnchorSelection(win, anchorInfo).bind(function (sel) { - var optRect = getFirstRect$1(win, SimSelection.exactFromRange(sel)).orThunk(function () { - var x = SugarElement.fromText(zeroWidth); - before(sel.start, x); - return getFirstRect$1(win, SimSelection.exact(x, 0, x, 1)).map(function (rect) { - remove(x); - return rect; - }); - }); - return optRect.bind(function (rawRect) { - return capRect(rawRect.left, rawRect.top, rawRect.width, rawRect.height); - }); - }); - var targetElement = getAnchorSelection(win, anchorInfo).bind(function (sel) { - return isElement(sel.start) ? Optional.some(sel.start) : parentNode(sel.start); - }); - var elem = targetElement.getOr(component.element); - return calcNewAnchor(selectionBox, rootPoint, anchorInfo, origin, elem); - }; - var SelectionAnchor = [ - option('getSelection'), - strict$1('root'), - option('bubble'), - schema$1(), - defaulted$1('overrides', {}), - defaulted$1('showAbove', false), - output('placement', placement$3) - ]; - - var eastX$1 = function (anchor) { - return anchor.x + anchor.width; - }; - var westX$1 = function (anchor, element) { - return anchor.x - element.width; - }; - var northY$1 = function (anchor, element) { - return anchor.y - element.height + anchor.height; - }; - var southY$1 = function (anchor) { - return anchor.y; - }; - var southeast$2 = function (anchor, element, bubbles) { - return nu$7(eastX$1(anchor), southY$1(anchor), bubbles.southeast(), southeast(), boundsRestriction(anchor, { - left: 0, - top: 2 - }), 'link-layout-se'); - }; - var southwest$2 = function (anchor, element, bubbles) { - return nu$7(westX$1(anchor, element), southY$1(anchor), bubbles.southwest(), southwest(), boundsRestriction(anchor, { - right: 1, - top: 2 - }), 'link-layout-sw'); - }; - var northeast$2 = function (anchor, element, bubbles) { - return nu$7(eastX$1(anchor), northY$1(anchor, element), bubbles.northeast(), northeast(), boundsRestriction(anchor, { - left: 0, - bottom: 3 - }), 'link-layout-ne'); - }; - var northwest$2 = function (anchor, element, bubbles) { - return nu$7(westX$1(anchor, element), northY$1(anchor, element), bubbles.northwest(), northwest(), boundsRestriction(anchor, { - right: 1, - bottom: 3 - }), 'link-layout-nw'); - }; - var all$3 = function () { - return [ - southeast$2, - southwest$2, - northeast$2, - northwest$2 - ]; - }; - var allRtl$1 = function () { - return [ - southwest$2, - southeast$2, - northwest$2, - northeast$2 - ]; - }; - - var placement$4 = function (component, submenuInfo, origin) { - var anchorBox = toBox(origin, submenuInfo.item.element); - var layouts = get$b(component.element, submenuInfo, all$3(), allRtl$1(), all$3(), allRtl$1(), Optional.none()); - return Optional.some(nu$9({ - anchorBox: anchorBox, - bubble: fallback(), - overrides: submenuInfo.overrides, - layouts: layouts, - placer: Optional.none() - })); - }; - var SubmenuAnchor = [ - strict$1('item'), - schema$1(), - defaulted$1('overrides', {}), - output('placement', placement$4) - ]; - - var AnchorSchema = choose$1('anchor', { - selection: SelectionAnchor, - node: NodeAnchor, - hotspot: HotspotAnchor, - submenu: SubmenuAnchor, - makeshift: MakeshiftAnchor - }); - - var getFixedOrigin = function () { - var html = document.documentElement; - return fixed(0, 0, html.clientWidth, html.clientHeight); - }; - var getRelativeOrigin = function (component) { - var position = absolute(component.element); - var bounds = component.element.dom.getBoundingClientRect(); - return relative(position.left, position.top, bounds.width, bounds.height); - }; - var place = function (component, origin, anchoring, getBounds, placee) { - var anchor = box$1(anchoring.anchorBox, origin); - simple(anchor, placee.element, anchoring.bubble, anchoring.layouts, getBounds, anchoring.overrides); - }; - var position$1 = function (component, posConfig, posState, anchor, placee) { - positionWithin(component, posConfig, posState, anchor, placee, Optional.none()); - }; - var positionWithin = function (component, posConfig, posState, anchor, placee, boxElement) { - var boundsBox = boxElement.map(box); - return positionWithinBounds(component, posConfig, posState, anchor, placee, boundsBox); - }; - var positionWithinBounds = function (component, posConfig, posState, anchor, placee, bounds) { - var anchorage = asRawOrDie('positioning anchor.info', AnchorSchema, anchor); - preserve(function () { - set$2(placee.element, 'position', 'fixed'); - var oldVisibility = getRaw(placee.element, 'visibility'); - set$2(placee.element, 'visibility', 'hidden'); - var origin = posConfig.useFixed() ? getFixedOrigin() : getRelativeOrigin(component); - var placer = anchorage.placement; - var getBounds = bounds.map(constant).or(posConfig.getBounds); - placer(component, anchorage, origin).each(function (anchoring) { - var doPlace = anchoring.placer.getOr(place); - doPlace(component, origin, anchoring, getBounds, placee); - }); - oldVisibility.fold(function () { - remove$6(placee.element, 'visibility'); - }, function (vis) { - set$2(placee.element, 'visibility', vis); - }); - if (getRaw(placee.element, 'left').isNone() && getRaw(placee.element, 'top').isNone() && getRaw(placee.element, 'right').isNone() && getRaw(placee.element, 'bottom').isNone() && getRaw(placee.element, 'position').is('fixed')) { - remove$6(placee.element, 'position'); - } - }, placee.element); - }; - var getMode = function (component, pConfig, _pState) { - return pConfig.useFixed() ? 'fixed' : 'absolute'; - }; - - var PositionApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - position: position$1, - positionWithin: positionWithin, - positionWithinBounds: positionWithinBounds, - getMode: getMode - }); - - var PositionSchema = [ - defaulted$1('useFixed', never), - option('getBounds') - ]; - - var Positioning = create$1({ - fields: PositionSchema, - name: 'positioning', - active: ActivePosition, - apis: PositionApis - }); - - var fireDetaching = function (component) { - emit(component, detachedFromDom()); - var children = component.components(); - each(children, fireDetaching); - }; - var fireAttaching = function (component) { - var children = component.components(); - each(children, fireAttaching); - emit(component, attachedToDom()); - }; - var attach = function (parent, child) { - append(parent.element, child.element); - }; - var detachChildren = function (component) { - each(component.components(), function (childComp) { - return remove(childComp.element); - }); - empty(component.element); - component.syncComponents(); - }; - var replaceChildren = function (component, newChildren) { - var subs = component.components(); - detachChildren(component); - var deleted = difference(subs, newChildren); - each(deleted, function (comp) { - fireDetaching(comp); - component.getSystem().removeFromWorld(comp); - }); - each(newChildren, function (childComp) { - if (!childComp.getSystem().isConnected()) { - component.getSystem().addToWorld(childComp); - attach(component, childComp); - if (inBody(component.element)) { - fireAttaching(childComp); - } - } else { - attach(component, childComp); - } - component.syncComponents(); - }); - }; - - var attach$1 = function (parent, child) { - attachWith(parent, child, append); - }; - var attachWith = function (parent, child, insertion) { - parent.getSystem().addToWorld(child); - insertion(parent.element, child.element); - if (inBody(parent.element)) { - fireAttaching(child); - } - parent.syncComponents(); - }; - var doDetach = function (component) { - fireDetaching(component); - remove(component.element); - component.getSystem().removeFromWorld(component); - }; - var detach = function (component) { - var parent$1 = parent(component.element).bind(function (p) { - return component.getSystem().getByDom(p).toOptional(); - }); - doDetach(component); - parent$1.each(function (p) { - p.syncComponents(); - }); - }; - var detachChildren$1 = function (component) { - var subs = component.components(); - each(subs, doDetach); - empty(component.element); - component.syncComponents(); - }; - var attachSystem = function (element, guiSystem) { - attachSystemWith(element, guiSystem, append); - }; - var attachSystemAfter = function (element, guiSystem) { - attachSystemWith(element, guiSystem, after); - }; - var attachSystemWith = function (element, guiSystem, inserter) { - inserter(element, guiSystem.element); - var children$1 = children(guiSystem.element); - each(children$1, function (child) { - guiSystem.getByDom(child).each(fireAttaching); - }); - }; - var detachSystem = function (guiSystem) { - var children$1 = children(guiSystem.element); - each(children$1, function (child) { - guiSystem.getByDom(child).each(fireDetaching); - }); - remove(guiSystem.element); - }; - - var rebuild = function (sandbox, sConfig, sState, data) { - sState.get().each(function (_data) { - detachChildren$1(sandbox); - }); - var point = sConfig.getAttachPoint(sandbox); - attach$1(point, sandbox); - var built = sandbox.getSystem().build(data); - attach$1(sandbox, built); - sState.set(built); - return built; - }; - var open = function (sandbox, sConfig, sState, data) { - var newState = rebuild(sandbox, sConfig, sState, data); - sConfig.onOpen(sandbox, newState); - return newState; - }; - var setContent = function (sandbox, sConfig, sState, data) { - return sState.get().map(function () { - return rebuild(sandbox, sConfig, sState, data); - }); - }; - var openWhileCloaked = function (sandbox, sConfig, sState, data, transaction) { - cloak(sandbox, sConfig); - open(sandbox, sConfig, sState, data); - transaction(); - decloak(sandbox, sConfig); - }; - var close = function (sandbox, sConfig, sState) { - sState.get().each(function (data) { - detachChildren$1(sandbox); - detach(sandbox); - sConfig.onClose(sandbox, data); - sState.clear(); - }); - }; - var isOpen = function (_sandbox, _sConfig, sState) { - return sState.isOpen(); - }; - var isPartOf$1 = function (sandbox, sConfig, sState, queryElem) { - return isOpen(sandbox, sConfig, sState) && sState.get().exists(function (data) { - return sConfig.isPartOf(sandbox, data, queryElem); - }); - }; - var getState = function (_sandbox, _sConfig, sState) { - return sState.get(); - }; - var store = function (sandbox, cssKey, attr, newValue) { - getRaw(sandbox.element, cssKey).fold(function () { - remove$1(sandbox.element, attr); - }, function (v) { - set$1(sandbox.element, attr, v); - }); - set$2(sandbox.element, cssKey, newValue); - }; - var restore = function (sandbox, cssKey, attr) { - getOpt(sandbox.element, attr).fold(function () { - return remove$6(sandbox.element, cssKey); - }, function (oldValue) { - return set$2(sandbox.element, cssKey, oldValue); - }); - }; - var cloak = function (sandbox, sConfig, _sState) { - var sink = sConfig.getAttachPoint(sandbox); - set$2(sandbox.element, 'position', Positioning.getMode(sink)); - store(sandbox, 'visibility', sConfig.cloakVisibilityAttr, 'hidden'); - }; - var hasPosition = function (element) { - return exists([ - 'top', - 'left', - 'right', - 'bottom' - ], function (pos) { - return getRaw(element, pos).isSome(); - }); - }; - var decloak = function (sandbox, sConfig, _sState) { - if (!hasPosition(sandbox.element)) { - remove$6(sandbox.element, 'position'); - } - restore(sandbox, 'visibility', sConfig.cloakVisibilityAttr); - }; - - var SandboxApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - cloak: cloak, - decloak: decloak, - open: open, - openWhileCloaked: openWhileCloaked, - close: close, - isOpen: isOpen, - isPartOf: isPartOf$1, - getState: getState, - setContent: setContent - }); - - var events$2 = function (sandboxConfig, sandboxState) { - return derive([run(sandboxClose(), function (sandbox, _simulatedEvent) { - close(sandbox, sandboxConfig, sandboxState); - })]); - }; - - var ActiveSandbox = /*#__PURE__*/Object.freeze({ - __proto__: null, - events: events$2 - }); - - var SandboxSchema = [ - onHandler('onOpen'), - onHandler('onClose'), - strict$1('isPartOf'), - strict$1('getAttachPoint'), - defaulted$1('cloakVisibilityAttr', 'data-precloak-visibility') - ]; - - var init = function () { - var contents = Cell(Optional.none()); - var readState = constant('not-implemented'); - var isOpen = function () { - return contents.get().isSome(); - }; - var set = function (comp) { - contents.set(Optional.some(comp)); - }; - var get = function () { - return contents.get(); - }; - var clear = function () { - contents.set(Optional.none()); - }; - return nu$5({ - readState: readState, - isOpen: isOpen, - clear: clear, - set: set, - get: get - }); - }; - - var SandboxState = /*#__PURE__*/Object.freeze({ - __proto__: null, - init: init - }); - - var Sandboxing = create$1({ - fields: SandboxSchema, - name: 'sandboxing', - active: ActiveSandbox, - apis: SandboxApis, - state: SandboxState - }); - - var dismissPopups = constant('dismiss.popups'); - var repositionPopups = constant('reposition.popups'); - var mouseReleased = constant('mouse.released'); - - var schema$2 = objOfOnly([ - defaulted$1('isExtraPart', never), - optionObjOf('fireEventInstead', [defaulted$1('event', dismissRequested())]) - ]); - var receivingChannel = function (rawSpec) { - var _a; - var detail = asRawOrDie('Dismissal', schema$2, rawSpec); - return _a = {}, _a[dismissPopups()] = { - schema: objOfOnly([strict$1('target')]), - onReceive: function (sandbox, data) { - if (Sandboxing.isOpen(sandbox)) { - var isPart = Sandboxing.isPartOf(sandbox, data.target) || detail.isExtraPart(sandbox, data.target); - if (!isPart) { - detail.fireEventInstead.fold(function () { - return Sandboxing.close(sandbox); - }, function (fe) { - return emit(sandbox, fe.event); - }); - } - } - } - }, _a; - }; - - var schema$3 = objOfOnly([ - optionObjOf('fireEventInstead', [defaulted$1('event', repositionRequested())]), - strictFunction('doReposition') - ]); - var receivingChannel$1 = function (rawSpec) { - var _a; - var detail = asRawOrDie('Reposition', schema$3, rawSpec); - return _a = {}, _a[repositionPopups()] = { - onReceive: function (sandbox) { - if (Sandboxing.isOpen(sandbox)) { - detail.fireEventInstead.fold(function () { - return detail.doReposition(sandbox); - }, function (fe) { - return emit(sandbox, fe.event); - }); - } - } - }, _a; - }; - - var onLoad = function (component, repConfig, repState) { - repConfig.store.manager.onLoad(component, repConfig, repState); - }; - var onUnload = function (component, repConfig, repState) { - repConfig.store.manager.onUnload(component, repConfig, repState); - }; - var setValue = function (component, repConfig, repState, data) { - repConfig.store.manager.setValue(component, repConfig, repState, data); - }; - var getValue = function (component, repConfig, repState) { - return repConfig.store.manager.getValue(component, repConfig, repState); - }; - var getState$1 = function (component, repConfig, repState) { - return repState; - }; - - var RepresentApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - onLoad: onLoad, - onUnload: onUnload, - setValue: setValue, - getValue: getValue, - getState: getState$1 - }); - - var events$3 = function (repConfig, repState) { - var es = repConfig.resetOnDom ? [ - runOnAttached(function (comp, _se) { - onLoad(comp, repConfig, repState); - }), - runOnDetached(function (comp, _se) { - onUnload(comp, repConfig, repState); - }) - ] : [loadEvent(repConfig, repState, onLoad)]; - return derive(es); - }; - - var ActiveRepresenting = /*#__PURE__*/Object.freeze({ - __proto__: null, - events: events$3 - }); - - var memory = function () { - var data = Cell(null); - var readState = function () { - return { - mode: 'memory', - value: data.get() - }; - }; - var isNotSet = function () { - return data.get() === null; - }; - var clear = function () { - data.set(null); - }; - return nu$5({ - set: data.set, - get: data.get, - isNotSet: isNotSet, - clear: clear, - readState: readState - }); - }; - var manual = function () { - var readState = noop; - return nu$5({ readState: readState }); - }; - var dataset = function () { - var dataByValue = Cell({}); - var dataByText = Cell({}); - var readState = function () { - return { - mode: 'dataset', - dataByValue: dataByValue.get(), - dataByText: dataByText.get() - }; - }; - var clear = function () { - dataByValue.set({}); - dataByText.set({}); - }; - var lookup = function (itemString) { - return get$1(dataByValue.get(), itemString).orThunk(function () { - return get$1(dataByText.get(), itemString); - }); - }; - var update = function (items) { - var currentDataByValue = dataByValue.get(); - var currentDataByText = dataByText.get(); - var newDataByValue = {}; - var newDataByText = {}; - each(items, function (item) { - newDataByValue[item.value] = item; - get$1(item, 'meta').each(function (meta) { - get$1(meta, 'text').each(function (text) { - newDataByText[text] = item; - }); - }); - }); - dataByValue.set(__assign(__assign({}, currentDataByValue), newDataByValue)); - dataByText.set(__assign(__assign({}, currentDataByText), newDataByText)); - }; - return nu$5({ - readState: readState, - lookup: lookup, - update: update, - clear: clear - }); - }; - var init$1 = function (spec) { - return spec.store.manager.state(spec); - }; - - var RepresentState = /*#__PURE__*/Object.freeze({ - __proto__: null, - memory: memory, - dataset: dataset, - manual: manual, - init: init$1 - }); - - var setValue$1 = function (component, repConfig, repState, data) { - var store = repConfig.store; - repState.update([data]); - store.setValue(component, data); - repConfig.onSetValue(component, data); - }; - var getValue$1 = function (component, repConfig, repState) { - var store = repConfig.store; - var key = store.getDataKey(component); - return repState.lookup(key).fold(function () { - return store.getFallbackEntry(key); - }, function (data) { - return data; - }); - }; - var onLoad$1 = function (component, repConfig, repState) { - var store = repConfig.store; - store.initialValue.each(function (data) { - setValue$1(component, repConfig, repState, data); - }); - }; - var onUnload$1 = function (component, repConfig, repState) { - repState.clear(); - }; - var DatasetStore = [ - option('initialValue'), - strict$1('getFallbackEntry'), - strict$1('getDataKey'), - strict$1('setValue'), - output('manager', { - setValue: setValue$1, - getValue: getValue$1, - onLoad: onLoad$1, - onUnload: onUnload$1, - state: dataset - }) - ]; - - var getValue$2 = function (component, repConfig, _repState) { - return repConfig.store.getValue(component); - }; - var setValue$2 = function (component, repConfig, _repState, data) { - repConfig.store.setValue(component, data); - repConfig.onSetValue(component, data); - }; - var onLoad$2 = function (component, repConfig, _repState) { - repConfig.store.initialValue.each(function (data) { - repConfig.store.setValue(component, data); - }); - }; - var ManualStore = [ - strict$1('getValue'), - defaulted$1('setValue', noop), - option('initialValue'), - output('manager', { - setValue: setValue$2, - getValue: getValue$2, - onLoad: onLoad$2, - onUnload: noop, - state: NoState.init - }) - ]; - - var setValue$3 = function (component, repConfig, repState, data) { - repState.set(data); - repConfig.onSetValue(component, data); - }; - var getValue$3 = function (component, repConfig, repState) { - return repState.get(); - }; - var onLoad$3 = function (component, repConfig, repState) { - repConfig.store.initialValue.each(function (initVal) { - if (repState.isNotSet()) { - repState.set(initVal); - } - }); - }; - var onUnload$2 = function (component, repConfig, repState) { - repState.clear(); - }; - var MemoryStore = [ - option('initialValue'), - output('manager', { - setValue: setValue$3, - getValue: getValue$3, - onLoad: onLoad$3, - onUnload: onUnload$2, - state: memory - }) - ]; - - var RepresentSchema = [ - defaultedOf('store', { mode: 'memory' }, choose$1('mode', { - memory: MemoryStore, - manual: ManualStore, - dataset: DatasetStore - })), - onHandler('onSetValue'), - defaulted$1('resetOnDom', false) - ]; - - var Representing = create$1({ - fields: RepresentSchema, - name: 'representing', - active: ActiveRepresenting, - apis: RepresentApis, - extra: { - setValueFrom: function (component, source) { - var value = Representing.getValue(source); - Representing.setValue(component, value); - } - }, - state: RepresentState - }); - - var field$1 = function (name, forbidden) { - return defaultedObjOf(name, {}, map(forbidden, function (f) { - return forbid(f.name(), 'Cannot configure ' + f.name() + ' for ' + name); - }).concat([state$1('dump', identity)])); - }; - var get$d = function (data) { - return data.dump; - }; - var augment = function (data, original) { - return __assign(__assign({}, data.dump), derive$1(original)); - }; - var SketchBehaviours = { - field: field$1, - augment: augment, - get: get$d - }; - - var _placeholder = 'placeholder'; - var adt$9 = Adt.generate([ - { - single: [ - 'required', - 'valueThunk' - ] - }, - { - multiple: [ - 'required', - 'valueThunks' - ] - } - ]); - var isSubstituted = function (spec) { - return has(spec, 'uiType'); - }; - var subPlaceholder = function (owner, detail, compSpec, placeholders) { - if (owner.exists(function (o) { - return o !== compSpec.owner; - })) { - return adt$9.single(true, constant(compSpec)); - } - return get$1(placeholders, compSpec.name).fold(function () { - throw new Error('Unknown placeholder component: ' + compSpec.name + '\nKnown: [' + keys(placeholders) + ']\nNamespace: ' + owner.getOr('none') + '\nSpec: ' + JSON.stringify(compSpec, null, 2)); - }, function (newSpec) { - return newSpec.replace(); - }); - }; - var scan = function (owner, detail, compSpec, placeholders) { - if (isSubstituted(compSpec) && compSpec.uiType === _placeholder) { - return subPlaceholder(owner, detail, compSpec, placeholders); - } else { - return adt$9.single(false, constant(compSpec)); - } - }; - var substitute = function (owner, detail, compSpec, placeholders) { - var base = scan(owner, detail, compSpec, placeholders); - return base.fold(function (req, valueThunk) { - var value = isSubstituted(compSpec) ? valueThunk(detail, compSpec.config, compSpec.validated) : valueThunk(detail); - var childSpecs = get$1(value, 'components').getOr([]); - var substituted = bind(childSpecs, function (c) { - return substitute(owner, detail, c, placeholders); - }); - return [__assign(__assign({}, value), { components: substituted })]; - }, function (req, valuesThunk) { - if (isSubstituted(compSpec)) { - var values = valuesThunk(detail, compSpec.config, compSpec.validated); - var preprocessor = compSpec.validated.preprocess.getOr(identity); - return preprocessor(values); - } else { - return valuesThunk(detail); - } - }); - }; - var substituteAll = function (owner, detail, components, placeholders) { - return bind(components, function (c) { - return substitute(owner, detail, c, placeholders); - }); - }; - var oneReplace = function (label, replacements) { - var called = false; - var used = function () { - return called; - }; - var replace = function () { - if (called) { - throw new Error('Trying to use the same placeholder more than once: ' + label); - } - called = true; - return replacements; - }; - var required = function () { - return replacements.fold(function (req, _) { - return req; - }, function (req, _) { - return req; - }); - }; - return { - name: constant(label), - required: required, - used: used, - replace: replace - }; - }; - var substitutePlaces = function (owner, detail, components, placeholders) { - var ps = map$2(placeholders, function (ph, name) { - return oneReplace(name, ph); - }); - var outcome = substituteAll(owner, detail, components, ps); - each$1(ps, function (p) { - if (p.used() === false && p.required()) { - throw new Error('Placeholder: ' + p.name() + ' was not found in components list\nNamespace: ' + owner.getOr('none') + '\nComponents: ' + JSON.stringify(detail.components, null, 2)); - } - }); - return outcome; - }; - var single = adt$9.single; - var multiple = adt$9.multiple; - var placeholder = constant(_placeholder); - - var adt$a = Adt.generate([ - { required: ['data'] }, - { external: ['data'] }, - { optional: ['data'] }, - { group: ['data'] } - ]); - var fFactory = defaulted$1('factory', { sketch: identity }); - var fSchema = defaulted$1('schema', []); - var fName = strict$1('name'); - var fPname = field('pname', 'pname', defaultedThunk(function (typeSpec) { - return ''; - }), anyValue$1()); - var fGroupSchema = state$1('schema', function () { - return [option('preprocess')]; - }); - var fDefaults = defaulted$1('defaults', constant({})); - var fOverrides = defaulted$1('overrides', constant({})); - var requiredSpec = objOf([ - fFactory, - fSchema, - fName, - fPname, - fDefaults, - fOverrides - ]); - var externalSpec = objOf([ - fFactory, - fSchema, - fName, - fDefaults, - fOverrides - ]); - var optionalSpec = objOf([ - fFactory, - fSchema, - fName, - fPname, - fDefaults, - fOverrides - ]); - var groupSpec = objOf([ - fFactory, - fGroupSchema, - fName, - strict$1('unit'), - fPname, - fDefaults, - fOverrides - ]); - var asNamedPart = function (part) { - return part.fold(Optional.some, Optional.none, Optional.some, Optional.some); - }; - var name$1 = function (part) { - var get = function (data) { - return data.name; - }; - return part.fold(get, get, get, get); - }; - var asCommon = function (part) { - return part.fold(identity, identity, identity, identity); - }; - var convert = function (adtConstructor, partSchema) { - return function (spec) { - var data = asRawOrDie('Converting part type', partSchema, spec); - return adtConstructor(data); - }; - }; - var required = convert(adt$a.required, requiredSpec); - var external$1 = convert(adt$a.external, externalSpec); - var optional = convert(adt$a.optional, optionalSpec); - var group = convert(adt$a.group, groupSpec); - var original = constant('entirety'); - - var PartType = /*#__PURE__*/Object.freeze({ - __proto__: null, - required: required, - external: external$1, - optional: optional, - group: group, - asNamedPart: asNamedPart, - name: name$1, - asCommon: asCommon, - original: original - }); - - var combine$2 = function (detail, data, partSpec, partValidated) { - return deepMerge(data.defaults(detail, partSpec, partValidated), partSpec, { uid: detail.partUids[data.name] }, data.overrides(detail, partSpec, partValidated)); - }; - var subs = function (owner, detail, parts) { - var internals = {}; - var externals = {}; - each(parts, function (part) { - part.fold(function (data) { - internals[data.pname] = single(true, function (detail, partSpec, partValidated) { - return data.factory.sketch(combine$2(detail, data, partSpec, partValidated)); - }); - }, function (data) { - var partSpec = detail.parts[data.name]; - externals[data.name] = constant(data.factory.sketch(combine$2(detail, data, partSpec[original()]), partSpec)); - }, function (data) { - internals[data.pname] = single(false, function (detail, partSpec, partValidated) { - return data.factory.sketch(combine$2(detail, data, partSpec, partValidated)); - }); - }, function (data) { - internals[data.pname] = multiple(true, function (detail, _partSpec, _partValidated) { - var units = detail[data.name]; - return map(units, function (u) { - return data.factory.sketch(deepMerge(data.defaults(detail, u, _partValidated), u, data.overrides(detail, u))); - }); - }); - }); - }); - return { - internals: constant(internals), - externals: constant(externals) - }; - }; - - var generate$4 = function (owner, parts) { - var r = {}; - each(parts, function (part) { - asNamedPart(part).each(function (np) { - var g = doGenerateOne(owner, np.pname); - r[np.name] = function (config) { - var validated = asRawOrDie('Part: ' + np.name + ' in ' + owner, objOf(np.schema), config); - return __assign(__assign({}, g), { - config: config, - validated: validated - }); - }; - }); - }); - return r; - }; - var doGenerateOne = function (owner, pname) { - return { - uiType: placeholder(), - owner: owner, - name: pname - }; - }; - var generateOne = function (owner, pname, config) { - return { - uiType: placeholder(), - owner: owner, - name: pname, - config: config, - validated: {} - }; - }; - var schemas = function (parts) { - return bind(parts, function (part) { - return part.fold(Optional.none, Optional.some, Optional.none, Optional.none).map(function (data) { - return strictObjOf(data.name, data.schema.concat([snapshot(original())])); - }).toArray(); - }); - }; - var names = function (parts) { - return map(parts, name$1); - }; - var substitutes = function (owner, detail, parts) { - return subs(owner, detail, parts); - }; - var components = function (owner, detail, internals) { - return substitutePlaces(Optional.some(owner), detail, detail.components, internals); - }; - var getPart = function (component, detail, partKey) { - var uid = detail.partUids[partKey]; - return component.getSystem().getByUid(uid).toOptional(); - }; - var getPartOrDie = function (component, detail, partKey) { - return getPart(component, detail, partKey).getOrDie('Could not find part: ' + partKey); - }; - var getParts = function (component, detail, partKeys) { - var r = {}; - var uids = detail.partUids; - var system = component.getSystem(); - each(partKeys, function (pk) { - r[pk] = constant(system.getByUid(uids[pk])); - }); - return r; - }; - var getAllParts = function (component, detail) { - var system = component.getSystem(); - return map$2(detail.partUids, function (pUid, _k) { - return constant(system.getByUid(pUid)); - }); - }; - var getAllPartNames = function (detail) { - return keys(detail.partUids); - }; - var getPartsOrDie = function (component, detail, partKeys) { - var r = {}; - var uids = detail.partUids; - var system = component.getSystem(); - each(partKeys, function (pk) { - r[pk] = constant(system.getByUid(uids[pk]).getOrDie()); - }); - return r; - }; - var defaultUids = function (baseUid, partTypes) { - var partNames = names(partTypes); - return wrapAll$1(map(partNames, function (pn) { - return { - key: pn, - value: baseUid + '-' + pn - }; - })); - }; - var defaultUidsSchema = function (partTypes) { - return field('partUids', 'partUids', mergeWithThunk(function (spec) { - return defaultUids(spec.uid, partTypes); - }), anyValue$1()); - }; - - var AlloyParts = /*#__PURE__*/Object.freeze({ - __proto__: null, - generate: generate$4, - generateOne: generateOne, - schemas: schemas, - names: names, - substitutes: substitutes, - components: components, - defaultUids: defaultUids, - defaultUidsSchema: defaultUidsSchema, - getAllParts: getAllParts, - getAllPartNames: getAllPartNames, - getPart: getPart, - getPartOrDie: getPartOrDie, - getParts: getParts, - getPartsOrDie: getPartsOrDie - }); - - var base = function (partSchemas, partUidsSchemas) { - var ps = partSchemas.length > 0 ? [strictObjOf('parts', partSchemas)] : []; - return ps.concat([ - strict$1('uid'), - defaulted$1('dom', {}), - defaulted$1('components', []), - snapshot('originalSpec'), - defaulted$1('debug.sketcher', {}) - ]).concat(partUidsSchemas); - }; - var asRawOrDie$1 = function (label, schema, spec, partSchemas, partUidsSchemas) { - var baseS = base(partSchemas, partUidsSchemas); - return asRawOrDie(label + ' [SpecSchema]', objOfOnly(baseS.concat(schema)), spec); - }; - - var single$1 = function (owner, schema, factory, spec) { - var specWithUid = supplyUid(spec); - var detail = asRawOrDie$1(owner, schema, specWithUid, [], []); - return factory(detail, specWithUid); - }; - var composite = function (owner, schema, partTypes, factory, spec) { - var specWithUid = supplyUid(spec); - var partSchemas = schemas(partTypes); - var partUidsSchema = defaultUidsSchema(partTypes); - var detail = asRawOrDie$1(owner, schema, specWithUid, partSchemas, [partUidsSchema]); - var subs = substitutes(owner, detail, partTypes); - var components$1 = components(owner, detail, subs.internals()); - return factory(detail, components$1, specWithUid, subs.externals()); - }; - var hasUid = function (spec) { - return has(spec, 'uid'); - }; - var supplyUid = function (spec) { - return hasUid(spec) ? spec : __assign(__assign({}, spec), { uid: generate$2('uid') }); - }; - - var isSketchSpec = function (spec) { - return spec.uid !== undefined; - }; - var singleSchema = objOfOnly([ - strict$1('name'), - strict$1('factory'), - strict$1('configFields'), - defaulted$1('apis', {}), - defaulted$1('extraApis', {}) - ]); - var compositeSchema = objOfOnly([ - strict$1('name'), - strict$1('factory'), - strict$1('configFields'), - strict$1('partFields'), - defaulted$1('apis', {}), - defaulted$1('extraApis', {}) - ]); - var single$2 = function (rawConfig) { - var config = asRawOrDie('Sketcher for ' + rawConfig.name, singleSchema, rawConfig); - var sketch = function (spec) { - return single$1(config.name, config.configFields, config.factory, spec); - }; - var apis = map$2(config.apis, makeApi); - var extraApis = map$2(config.extraApis, function (f, k) { - return markAsExtraApi(f, k); - }); - return __assign(__assign({ - name: config.name, - configFields: config.configFields, - sketch: sketch - }, apis), extraApis); - }; - var composite$1 = function (rawConfig) { - var config = asRawOrDie('Sketcher for ' + rawConfig.name, compositeSchema, rawConfig); - var sketch = function (spec) { - return composite(config.name, config.configFields, config.partFields, config.factory, spec); - }; - var parts = generate$4(config.name, config.partFields); - var apis = map$2(config.apis, makeApi); - var extraApis = map$2(config.extraApis, function (f, k) { - return markAsExtraApi(f, k); - }); - return __assign(__assign({ - name: config.name, - partFields: config.partFields, - configFields: config.configFields, - sketch: sketch, - parts: parts - }, apis), extraApis); - }; - - var cat = function (arr) { - var r = []; - var push = function (x) { - r.push(x); - }; - for (var i = 0; i < arr.length; i++) { - arr[i].each(push); - } - return r; - }; - var sequence = function (arr) { - var r = []; - for (var i = 0; i < arr.length; i++) { - var x = arr[i]; - if (x.isSome()) { - r.push(x.getOrDie()); - } else { - return Optional.none(); - } - } - return Optional.some(r); - }; - var lift2 = function (oa, ob, f) { - return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none(); - }; - var lift3 = function (oa, ob, oc, f) { - return oa.isSome() && ob.isSome() && oc.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie(), oc.getOrDie())) : Optional.none(); - }; - var mapFrom = function (a, f) { - return a !== undefined && a !== null ? Optional.some(f(a)) : Optional.none(); - }; - var someIf = function (b, a) { - return b ? Optional.some(a) : Optional.none(); - }; - - var inside = function (target) { - return name(target) === 'input' && get$3(target, 'type') !== 'radio' || name(target) === 'textarea'; - }; - - var getCurrent = function (component, composeConfig, _composeState) { - return composeConfig.find(component); - }; - - var ComposeApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - getCurrent: getCurrent - }); - - var ComposeSchema = [strict$1('find')]; - - var Composing = create$1({ - fields: ComposeSchema, - name: 'composing', - apis: ComposeApis - }); - - var dehighlightAllExcept = function (component, hConfig, hState, skip) { - var highlighted = descendants(component.element, '.' + hConfig.highlightClass); - each(highlighted, function (h) { - if (!exists(skip, function (skipComp) { - return skipComp.element === h; - })) { - remove$4(h, hConfig.highlightClass); - component.getSystem().getByDom(h).each(function (target) { - hConfig.onDehighlight(component, target); - emit(target, dehighlight()); - }); - } - }); - }; - var dehighlightAll = function (component, hConfig, hState) { - return dehighlightAllExcept(component, hConfig, hState, []); - }; - var dehighlight$1 = function (component, hConfig, hState, target) { - if (isHighlighted(component, hConfig, hState, target)) { - remove$4(target.element, hConfig.highlightClass); - hConfig.onDehighlight(component, target); - emit(target, dehighlight()); - } - }; - var highlight$1 = function (component, hConfig, hState, target) { - dehighlightAllExcept(component, hConfig, hState, [target]); - if (!isHighlighted(component, hConfig, hState, target)) { - add$2(target.element, hConfig.highlightClass); - hConfig.onHighlight(component, target); - emit(target, highlight()); - } - }; - var highlightFirst = function (component, hConfig, hState) { - getFirst(component, hConfig).each(function (firstComp) { - highlight$1(component, hConfig, hState, firstComp); - }); - }; - var highlightLast = function (component, hConfig, hState) { - getLast(component, hConfig).each(function (lastComp) { - highlight$1(component, hConfig, hState, lastComp); - }); - }; - var highlightAt = function (component, hConfig, hState, index) { - getByIndex(component, hConfig, hState, index).fold(function (err) { - throw err; - }, function (firstComp) { - highlight$1(component, hConfig, hState, firstComp); - }); - }; - var highlightBy = function (component, hConfig, hState, predicate) { - var candidates = getCandidates(component, hConfig); - var targetComp = find(candidates, predicate); - targetComp.each(function (c) { - highlight$1(component, hConfig, hState, c); - }); - }; - var isHighlighted = function (component, hConfig, hState, queryTarget) { - return has$2(queryTarget.element, hConfig.highlightClass); - }; - var getHighlighted = function (component, hConfig, _hState) { - return descendant$1(component.element, '.' + hConfig.highlightClass).bind(function (e) { - return component.getSystem().getByDom(e).toOptional(); - }); - }; - var getByIndex = function (component, hConfig, hState, index) { - var items = descendants(component.element, '.' + hConfig.itemClass); - return Optional.from(items[index]).fold(function () { - return Result.error(new Error('No element found with index ' + index)); - }, component.getSystem().getByDom); - }; - var getFirst = function (component, hConfig, _hState) { - return descendant$1(component.element, '.' + hConfig.itemClass).bind(function (e) { - return component.getSystem().getByDom(e).toOptional(); - }); - }; - var getLast = function (component, hConfig, _hState) { - var items = descendants(component.element, '.' + hConfig.itemClass); - var last = items.length > 0 ? Optional.some(items[items.length - 1]) : Optional.none(); - return last.bind(function (c) { - return component.getSystem().getByDom(c).toOptional(); - }); - }; - var getDelta = function (component, hConfig, hState, delta) { - var items = descendants(component.element, '.' + hConfig.itemClass); - var current = findIndex(items, function (item) { - return has$2(item, hConfig.highlightClass); - }); - return current.bind(function (selected) { - var dest = cycleBy(selected, delta, 0, items.length - 1); - return component.getSystem().getByDom(items[dest]).toOptional(); - }); - }; - var getPrevious = function (component, hConfig, hState) { - return getDelta(component, hConfig, hState, -1); - }; - var getNext = function (component, hConfig, hState) { - return getDelta(component, hConfig, hState, +1); - }; - var getCandidates = function (component, hConfig, _hState) { - var items = descendants(component.element, '.' + hConfig.itemClass); - return cat(map(items, function (i) { - return component.getSystem().getByDom(i).toOptional(); - })); - }; - - var HighlightApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - dehighlightAll: dehighlightAll, - dehighlight: dehighlight$1, - highlight: highlight$1, - highlightFirst: highlightFirst, - highlightLast: highlightLast, - highlightAt: highlightAt, - highlightBy: highlightBy, - isHighlighted: isHighlighted, - getHighlighted: getHighlighted, - getFirst: getFirst, - getLast: getLast, - getPrevious: getPrevious, - getNext: getNext, - getCandidates: getCandidates - }); - - var HighlightSchema = [ - strict$1('highlightClass'), - strict$1('itemClass'), - onHandler('onHighlight'), - onHandler('onDehighlight') - ]; - - var Highlighting = create$1({ - fields: HighlightSchema, - name: 'highlighting', - apis: HighlightApis - }); - - var BACKSPACE = [8]; - var TAB = [9]; - var ENTER = [13]; - var ESCAPE = [27]; - var SPACE = [32]; - var LEFT = [37]; - var UP = [38]; - var RIGHT = [39]; - var DOWN = [40]; - - var cyclePrev = function (values, index, predicate) { - var before = reverse(values.slice(0, index)); - var after = reverse(values.slice(index + 1)); - return find(before.concat(after), predicate); - }; - var tryPrev = function (values, index, predicate) { - var before = reverse(values.slice(0, index)); - return find(before, predicate); - }; - var cycleNext = function (values, index, predicate) { - var before = values.slice(0, index); - var after = values.slice(index + 1); - return find(after.concat(before), predicate); - }; - var tryNext = function (values, index, predicate) { - var after = values.slice(index + 1); - return find(after, predicate); - }; - - var inSet = function (keys) { - return function (event) { - var raw = event.raw; - return contains(keys, raw.which); - }; - }; - var and = function (preds) { - return function (event) { - return forall(preds, function (pred) { - return pred(event); - }); - }; - }; - var isShift = function (event) { - var raw = event.raw; - return raw.shiftKey === true; - }; - var isControl = function (event) { - var raw = event.raw; - return raw.ctrlKey === true; - }; - var isNotShift = not(isShift); - - var rule = function (matches, action) { - return { - matches: matches, - classification: action - }; - }; - var choose$2 = function (transitions, event) { - var transition = find(transitions, function (t) { - return t.matches(event); - }); - return transition.map(function (t) { - return t.classification; - }); - }; - - var reportFocusShifting = function (component, prevFocus, newFocus) { - var noChange = prevFocus.exists(function (p) { - return newFocus.exists(function (n) { - return eq$1(n, p); - }); - }); - if (!noChange) { - emitWith(component, focusShifted(), { - prevFocus: prevFocus, - newFocus: newFocus - }); - } - }; - var dom = function () { - var get = function (component) { - return search(component.element); - }; - var set = function (component, focusee) { - var prevFocus = get(component); - component.getSystem().triggerFocus(focusee, component.element); - var newFocus = get(component); - reportFocusShifting(component, prevFocus, newFocus); - }; - return { - get: get, - set: set - }; - }; - var highlights = function () { - var get = function (component) { - return Highlighting.getHighlighted(component).map(function (item) { - return item.element; - }); - }; - var set = function (component, element) { - var prevFocus = get(component); - component.getSystem().getByDom(element).fold(noop, function (item) { - Highlighting.highlight(component, item); - }); - var newFocus = get(component); - reportFocusShifting(component, prevFocus, newFocus); - }; - return { - get: get, - set: set - }; - }; - - var FocusInsideModes; - (function (FocusInsideModes) { - FocusInsideModes['OnFocusMode'] = 'onFocus'; - FocusInsideModes['OnEnterOrSpaceMode'] = 'onEnterOrSpace'; - FocusInsideModes['OnApiMode'] = 'onApi'; - }(FocusInsideModes || (FocusInsideModes = {}))); - - var typical = function (infoSchema, stateInit, getKeydownRules, getKeyupRules, optFocusIn) { - var schema = function () { - return infoSchema.concat([ - defaulted$1('focusManager', dom()), - defaultedOf('focusInside', 'onFocus', valueOf(function (val) { - return contains([ - 'onFocus', - 'onEnterOrSpace', - 'onApi' - ], val) ? Result.value(val) : Result.error('Invalid value for focusInside'); - })), - output('handler', me), - output('state', stateInit), - output('sendFocusIn', optFocusIn) - ]); - }; - var processKey = function (component, simulatedEvent, getRules, keyingConfig, keyingState) { - var rules = getRules(component, simulatedEvent, keyingConfig, keyingState); - return choose$2(rules, simulatedEvent.event).bind(function (rule) { - return rule(component, simulatedEvent, keyingConfig, keyingState); - }); - }; - var toEvents = function (keyingConfig, keyingState) { - var onFocusHandler = keyingConfig.focusInside !== FocusInsideModes.OnFocusMode ? Optional.none() : optFocusIn(keyingConfig).map(function (focusIn) { - return run(focus(), function (component, simulatedEvent) { - focusIn(component, keyingConfig, keyingState); - simulatedEvent.stop(); - }); - }); - var tryGoInsideComponent = function (component, simulatedEvent) { - var isEnterOrSpace = inSet(SPACE.concat(ENTER))(simulatedEvent.event); - if (keyingConfig.focusInside === FocusInsideModes.OnEnterOrSpaceMode && isEnterOrSpace && isSource(component, simulatedEvent)) { - optFocusIn(keyingConfig).each(function (focusIn) { - focusIn(component, keyingConfig, keyingState); - simulatedEvent.stop(); - }); - } - }; - var keyboardEvents = [ - run(keydown(), function (component, simulatedEvent) { - processKey(component, simulatedEvent, getKeydownRules, keyingConfig, keyingState).fold(function () { - tryGoInsideComponent(component, simulatedEvent); - }, function (_) { - simulatedEvent.stop(); - }); - }), - run(keyup(), function (component, simulatedEvent) { - processKey(component, simulatedEvent, getKeyupRules, keyingConfig, keyingState).each(function (_) { - simulatedEvent.stop(); - }); - }) - ]; - return derive(onFocusHandler.toArray().concat(keyboardEvents)); - }; - var me = { - schema: schema, - processKey: processKey, - toEvents: toEvents - }; - return me; - }; - - var create$3 = function (cyclicField) { - var schema = [ - option('onEscape'), - option('onEnter'), - defaulted$1('selector', '[data-alloy-tabstop="true"]:not(:disabled)'), - defaulted$1('firstTabstop', 0), - defaulted$1('useTabstopAt', always), - option('visibilitySelector') - ].concat([cyclicField]); - var isVisible = function (tabbingConfig, element) { - var target = tabbingConfig.visibilitySelector.bind(function (sel) { - return closest$3(element, sel); - }).getOr(element); - return get$7(target) > 0; - }; - var findInitial = function (component, tabbingConfig) { - var tabstops = descendants(component.element, tabbingConfig.selector); - var visibles = filter(tabstops, function (elem) { - return isVisible(tabbingConfig, elem); - }); - return Optional.from(visibles[tabbingConfig.firstTabstop]); - }; - var findCurrent = function (component, tabbingConfig) { - return tabbingConfig.focusManager.get(component).bind(function (elem) { - return closest$3(elem, tabbingConfig.selector); - }); - }; - var isTabstop = function (tabbingConfig, element) { - return isVisible(tabbingConfig, element) && tabbingConfig.useTabstopAt(element); - }; - var focusIn = function (component, tabbingConfig, _tabbingState) { - findInitial(component, tabbingConfig).each(function (target) { - tabbingConfig.focusManager.set(component, target); - }); - }; - var goFromTabstop = function (component, tabstops, stopIndex, tabbingConfig, cycle) { - return cycle(tabstops, stopIndex, function (elem) { - return isTabstop(tabbingConfig, elem); - }).fold(function () { - return tabbingConfig.cyclic ? Optional.some(true) : Optional.none(); - }, function (target) { - tabbingConfig.focusManager.set(component, target); - return Optional.some(true); - }); - }; - var go = function (component, _simulatedEvent, tabbingConfig, cycle) { - var tabstops = descendants(component.element, tabbingConfig.selector); - return findCurrent(component, tabbingConfig).bind(function (tabstop) { - var optStopIndex = findIndex(tabstops, curry(eq$1, tabstop)); - return optStopIndex.bind(function (stopIndex) { - return goFromTabstop(component, tabstops, stopIndex, tabbingConfig, cycle); - }); - }); - }; - var goBackwards = function (component, simulatedEvent, tabbingConfig) { - var navigate = tabbingConfig.cyclic ? cyclePrev : tryPrev; - return go(component, simulatedEvent, tabbingConfig, navigate); - }; - var goForwards = function (component, simulatedEvent, tabbingConfig) { - var navigate = tabbingConfig.cyclic ? cycleNext : tryNext; - return go(component, simulatedEvent, tabbingConfig, navigate); - }; - var execute = function (component, simulatedEvent, tabbingConfig) { - return tabbingConfig.onEnter.bind(function (f) { - return f(component, simulatedEvent); - }); - }; - var exit = function (component, simulatedEvent, tabbingConfig) { - return tabbingConfig.onEscape.bind(function (f) { - return f(component, simulatedEvent); - }); - }; - var getKeydownRules = constant([ - rule(and([ - isShift, - inSet(TAB) - ]), goBackwards), - rule(inSet(TAB), goForwards), - rule(inSet(ESCAPE), exit), - rule(and([ - isNotShift, - inSet(ENTER) - ]), execute) - ]); - var getKeyupRules = constant([]); - return typical(schema, NoState.init, getKeydownRules, getKeyupRules, function () { - return Optional.some(focusIn); - }); - }; - - var AcyclicType = create$3(state$1('cyclic', never)); - - var CyclicType = create$3(state$1('cyclic', always)); - - var doDefaultExecute = function (component, _simulatedEvent, focused) { - dispatch(component, focused, execute()); - return Optional.some(true); - }; - var defaultExecute = function (component, simulatedEvent, focused) { - var isComplex = inside(focused) && inSet(SPACE)(simulatedEvent.event); - return isComplex ? Optional.none() : doDefaultExecute(component, simulatedEvent, focused); - }; - var stopEventForFirefox = function (_component, _simulatedEvent) { - return Optional.some(true); - }; - - var schema$4 = [ - defaulted$1('execute', defaultExecute), - defaulted$1('useSpace', false), - defaulted$1('useEnter', true), - defaulted$1('useControlEnter', false), - defaulted$1('useDown', false) - ]; - var execute$1 = function (component, simulatedEvent, executeConfig) { - return executeConfig.execute(component, simulatedEvent, component.element); - }; - var getKeydownRules = function (component, _simulatedEvent, executeConfig, _executeState) { - var spaceExec = executeConfig.useSpace && !inside(component.element) ? SPACE : []; - var enterExec = executeConfig.useEnter ? ENTER : []; - var downExec = executeConfig.useDown ? DOWN : []; - var execKeys = spaceExec.concat(enterExec).concat(downExec); - return [rule(inSet(execKeys), execute$1)].concat(executeConfig.useControlEnter ? [rule(and([ - isControl, - inSet(ENTER) - ]), execute$1)] : []); - }; - var getKeyupRules = function (component, _simulatedEvent, executeConfig, _executeState) { - return executeConfig.useSpace && !inside(component.element) ? [rule(inSet(SPACE), stopEventForFirefox)] : []; - }; - var ExecutionType = typical(schema$4, NoState.init, getKeydownRules, getKeyupRules, function () { - return Optional.none(); - }); - - var flatgrid = function () { - var dimensions = Cell(Optional.none()); - var setGridSize = function (numRows, numColumns) { - dimensions.set(Optional.some({ - numRows: numRows, - numColumns: numColumns - })); - }; - var getNumRows = function () { - return dimensions.get().map(function (d) { - return d.numRows; - }); - }; - var getNumColumns = function () { - return dimensions.get().map(function (d) { - return d.numColumns; - }); - }; - return nu$5({ - readState: function () { - return dimensions.get().map(function (d) { - return { - numRows: String(d.numRows), - numColumns: String(d.numColumns) - }; - }).getOr({ - numRows: '?', - numColumns: '?' - }); - }, - setGridSize: setGridSize, - getNumRows: getNumRows, - getNumColumns: getNumColumns - }); - }; - var init$2 = function (spec) { - return spec.state(spec); - }; - - var KeyingState = /*#__PURE__*/Object.freeze({ - __proto__: null, - flatgrid: flatgrid, - init: init$2 - }); - - var useH = function (movement) { - return function (component, simulatedEvent, config, state) { - var move = movement(component.element); - return use(move, component, simulatedEvent, config, state); - }; - }; - var west$2 = function (moveLeft, moveRight) { - var movement = onDirection(moveLeft, moveRight); - return useH(movement); - }; - var east$2 = function (moveLeft, moveRight) { - var movement = onDirection(moveRight, moveLeft); - return useH(movement); - }; - var useV = function (move) { - return function (component, simulatedEvent, config, state) { - return use(move, component, simulatedEvent, config, state); - }; - }; - var use = function (move, component, simulatedEvent, config, state) { - var outcome = config.focusManager.get(component).bind(function (focused) { - return move(component.element, focused, config, state); - }); - return outcome.map(function (newFocus) { - config.focusManager.set(component, newFocus); - return true; - }); - }; - var north$2 = useV; - var south$2 = useV; - var move = useV; - - var isHidden = function (dom) { - return dom.offsetWidth <= 0 && dom.offsetHeight <= 0; - }; - var isVisible = function (element) { - return !isHidden(element.dom); - }; - - var locate = function (candidates, predicate) { - return findIndex(candidates, predicate).map(function (index) { - return { - index: index, - candidates: candidates - }; - }); - }; - - var locateVisible = function (container, current, selector) { - var predicate = function (x) { - return eq$1(x, current); - }; - var candidates = descendants(container, selector); - var visible = filter(candidates, isVisible); - return locate(visible, predicate); - }; - var findIndex$1 = function (elements, target) { - return findIndex(elements, function (elem) { - return eq$1(target, elem); - }); - }; - - var withGrid = function (values, index, numCols, f) { - var oldRow = Math.floor(index / numCols); - var oldColumn = index % numCols; - return f(oldRow, oldColumn).bind(function (address) { - var newIndex = address.row * numCols + address.column; - return newIndex >= 0 && newIndex < values.length ? Optional.some(values[newIndex]) : Optional.none(); - }); - }; - var cycleHorizontal = function (values, index, numRows, numCols, delta) { - return withGrid(values, index, numCols, function (oldRow, oldColumn) { - var onLastRow = oldRow === numRows - 1; - var colsInRow = onLastRow ? values.length - oldRow * numCols : numCols; - var newColumn = cycleBy(oldColumn, delta, 0, colsInRow - 1); - return Optional.some({ - row: oldRow, - column: newColumn - }); - }); - }; - var cycleVertical = function (values, index, numRows, numCols, delta) { - return withGrid(values, index, numCols, function (oldRow, oldColumn) { - var newRow = cycleBy(oldRow, delta, 0, numRows - 1); - var onLastRow = newRow === numRows - 1; - var colsInRow = onLastRow ? values.length - newRow * numCols : numCols; - var newCol = clamp(oldColumn, 0, colsInRow - 1); - return Optional.some({ - row: newRow, - column: newCol - }); - }); - }; - var cycleRight = function (values, index, numRows, numCols) { - return cycleHorizontal(values, index, numRows, numCols, +1); - }; - var cycleLeft = function (values, index, numRows, numCols) { - return cycleHorizontal(values, index, numRows, numCols, -1); - }; - var cycleUp = function (values, index, numRows, numCols) { - return cycleVertical(values, index, numRows, numCols, -1); - }; - var cycleDown = function (values, index, numRows, numCols) { - return cycleVertical(values, index, numRows, numCols, +1); - }; - - var schema$5 = [ - strict$1('selector'), - defaulted$1('execute', defaultExecute), - onKeyboardHandler('onEscape'), - defaulted$1('captureTab', false), - initSize() - ]; - var focusIn = function (component, gridConfig, _gridState) { - descendant$1(component.element, gridConfig.selector).each(function (first) { - gridConfig.focusManager.set(component, first); - }); - }; - var findCurrent = function (component, gridConfig) { - return gridConfig.focusManager.get(component).bind(function (elem) { - return closest$3(elem, gridConfig.selector); - }); - }; - var execute$2 = function (component, simulatedEvent, gridConfig, _gridState) { - return findCurrent(component, gridConfig).bind(function (focused) { - return gridConfig.execute(component, simulatedEvent, focused); - }); - }; - var doMove = function (cycle) { - return function (element, focused, gridConfig, gridState) { - return locateVisible(element, focused, gridConfig.selector).bind(function (identified) { - return cycle(identified.candidates, identified.index, gridState.getNumRows().getOr(gridConfig.initSize.numRows), gridState.getNumColumns().getOr(gridConfig.initSize.numColumns)); - }); - }; - }; - var handleTab = function (_component, _simulatedEvent, gridConfig) { - return gridConfig.captureTab ? Optional.some(true) : Optional.none(); - }; - var doEscape = function (component, simulatedEvent, gridConfig) { - return gridConfig.onEscape(component, simulatedEvent); - }; - var moveLeft = doMove(cycleLeft); - var moveRight = doMove(cycleRight); - var moveNorth = doMove(cycleUp); - var moveSouth = doMove(cycleDown); - var getKeydownRules$1 = constant([ - rule(inSet(LEFT), west$2(moveLeft, moveRight)), - rule(inSet(RIGHT), east$2(moveLeft, moveRight)), - rule(inSet(UP), north$2(moveNorth)), - rule(inSet(DOWN), south$2(moveSouth)), - rule(and([ - isShift, - inSet(TAB) - ]), handleTab), - rule(and([ - isNotShift, - inSet(TAB) - ]), handleTab), - rule(inSet(ESCAPE), doEscape), - rule(inSet(SPACE.concat(ENTER)), execute$2) - ]); - var getKeyupRules$1 = constant([rule(inSet(SPACE), stopEventForFirefox)]); - var FlatgridType = typical(schema$5, flatgrid, getKeydownRules$1, getKeyupRules$1, function () { - return Optional.some(focusIn); - }); - - var horizontal = function (container, selector, current, delta) { - var isDisabledButton = function (candidate) { - return name(candidate) === 'button' && get$3(candidate, 'disabled') === 'disabled'; - }; - var tryCycle = function (initial, index, candidates) { - var newIndex = cycleBy(index, delta, 0, candidates.length - 1); - if (newIndex === initial) { - return Optional.none(); - } else { - return isDisabledButton(candidates[newIndex]) ? tryCycle(initial, newIndex, candidates) : Optional.from(candidates[newIndex]); - } - }; - return locateVisible(container, current, selector).bind(function (identified) { - var index = identified.index; - var candidates = identified.candidates; - return tryCycle(index, index, candidates); - }); - }; - - var schema$6 = [ - strict$1('selector'), - defaulted$1('getInitial', Optional.none), - defaulted$1('execute', defaultExecute), - onKeyboardHandler('onEscape'), - defaulted$1('executeOnMove', false), - defaulted$1('allowVertical', true) - ]; - var findCurrent$1 = function (component, flowConfig) { - return flowConfig.focusManager.get(component).bind(function (elem) { - return closest$3(elem, flowConfig.selector); - }); - }; - var execute$3 = function (component, simulatedEvent, flowConfig) { - return findCurrent$1(component, flowConfig).bind(function (focused) { - return flowConfig.execute(component, simulatedEvent, focused); - }); - }; - var focusIn$1 = function (component, flowConfig, _state) { - flowConfig.getInitial(component).orThunk(function () { - return descendant$1(component.element, flowConfig.selector); - }).each(function (first) { - flowConfig.focusManager.set(component, first); - }); - }; - var moveLeft$1 = function (element, focused, info) { - return horizontal(element, info.selector, focused, -1); - }; - var moveRight$1 = function (element, focused, info) { - return horizontal(element, info.selector, focused, +1); - }; - var doMove$1 = function (movement) { - return function (component, simulatedEvent, flowConfig, flowState) { - return movement(component, simulatedEvent, flowConfig, flowState).bind(function () { - return flowConfig.executeOnMove ? execute$3(component, simulatedEvent, flowConfig) : Optional.some(true); - }); - }; - }; - var doEscape$1 = function (component, simulatedEvent, flowConfig) { - return flowConfig.onEscape(component, simulatedEvent); - }; - var getKeydownRules$2 = function (_component, _se, flowConfig, _flowState) { - var westMovers = LEFT.concat(flowConfig.allowVertical ? UP : []); - var eastMovers = RIGHT.concat(flowConfig.allowVertical ? DOWN : []); - return [ - rule(inSet(westMovers), doMove$1(west$2(moveLeft$1, moveRight$1))), - rule(inSet(eastMovers), doMove$1(east$2(moveLeft$1, moveRight$1))), - rule(inSet(ENTER), execute$3), - rule(inSet(SPACE), execute$3), - rule(inSet(ESCAPE), doEscape$1) - ]; - }; - var getKeyupRules$2 = constant([rule(inSet(SPACE), stopEventForFirefox)]); - var FlowType = typical(schema$6, NoState.init, getKeydownRules$2, getKeyupRules$2, function () { - return Optional.some(focusIn$1); - }); - - var toCell = function (matrix, rowIndex, columnIndex) { - return Optional.from(matrix[rowIndex]).bind(function (row) { - return Optional.from(row[columnIndex]).map(function (cell) { - return { - rowIndex: rowIndex, - columnIndex: columnIndex, - cell: cell - }; - }); - }); - }; - var cycleHorizontal$1 = function (matrix, rowIndex, startCol, deltaCol) { - var row = matrix[rowIndex]; - var colsInRow = row.length; - var newColIndex = cycleBy(startCol, deltaCol, 0, colsInRow - 1); - return toCell(matrix, rowIndex, newColIndex); - }; - var cycleVertical$1 = function (matrix, colIndex, startRow, deltaRow) { - var nextRowIndex = cycleBy(startRow, deltaRow, 0, matrix.length - 1); - var colsInNextRow = matrix[nextRowIndex].length; - var nextColIndex = clamp(colIndex, 0, colsInNextRow - 1); - return toCell(matrix, nextRowIndex, nextColIndex); - }; - var moveHorizontal = function (matrix, rowIndex, startCol, deltaCol) { - var row = matrix[rowIndex]; - var colsInRow = row.length; - var newColIndex = clamp(startCol + deltaCol, 0, colsInRow - 1); - return toCell(matrix, rowIndex, newColIndex); - }; - var moveVertical = function (matrix, colIndex, startRow, deltaRow) { - var nextRowIndex = clamp(startRow + deltaRow, 0, matrix.length - 1); - var colsInNextRow = matrix[nextRowIndex].length; - var nextColIndex = clamp(colIndex, 0, colsInNextRow - 1); - return toCell(matrix, nextRowIndex, nextColIndex); - }; - var cycleRight$1 = function (matrix, startRow, startCol) { - return cycleHorizontal$1(matrix, startRow, startCol, +1); - }; - var cycleLeft$1 = function (matrix, startRow, startCol) { - return cycleHorizontal$1(matrix, startRow, startCol, -1); - }; - var cycleUp$1 = function (matrix, startRow, startCol) { - return cycleVertical$1(matrix, startCol, startRow, -1); - }; - var cycleDown$1 = function (matrix, startRow, startCol) { - return cycleVertical$1(matrix, startCol, startRow, +1); - }; - var moveLeft$2 = function (matrix, startRow, startCol) { - return moveHorizontal(matrix, startRow, startCol, -1); - }; - var moveRight$2 = function (matrix, startRow, startCol) { - return moveHorizontal(matrix, startRow, startCol, +1); - }; - var moveUp = function (matrix, startRow, startCol) { - return moveVertical(matrix, startCol, startRow, -1); - }; - var moveDown = function (matrix, startRow, startCol) { - return moveVertical(matrix, startCol, startRow, +1); - }; - - var schema$7 = [ - strictObjOf('selectors', [ - strict$1('row'), - strict$1('cell') - ]), - defaulted$1('cycles', true), - defaulted$1('previousSelector', Optional.none), - defaulted$1('execute', defaultExecute) - ]; - var focusIn$2 = function (component, matrixConfig, _state) { - var focused = matrixConfig.previousSelector(component).orThunk(function () { - var selectors = matrixConfig.selectors; - return descendant$1(component.element, selectors.cell); - }); - focused.each(function (cell) { - matrixConfig.focusManager.set(component, cell); - }); - }; - var execute$4 = function (component, simulatedEvent, matrixConfig) { - return search(component.element).bind(function (focused) { - return matrixConfig.execute(component, simulatedEvent, focused); - }); - }; - var toMatrix = function (rows, matrixConfig) { - return map(rows, function (row) { - return descendants(row, matrixConfig.selectors.cell); - }); - }; - var doMove$2 = function (ifCycle, ifMove) { - return function (element, focused, matrixConfig) { - var move = matrixConfig.cycles ? ifCycle : ifMove; - return closest$3(focused, matrixConfig.selectors.row).bind(function (inRow) { - var cellsInRow = descendants(inRow, matrixConfig.selectors.cell); - return findIndex$1(cellsInRow, focused).bind(function (colIndex) { - var allRows = descendants(element, matrixConfig.selectors.row); - return findIndex$1(allRows, inRow).bind(function (rowIndex) { - var matrix = toMatrix(allRows, matrixConfig); - return move(matrix, rowIndex, colIndex).map(function (next) { - return next.cell; - }); - }); - }); - }); - }; - }; - var moveLeft$3 = doMove$2(cycleLeft$1, moveLeft$2); - var moveRight$3 = doMove$2(cycleRight$1, moveRight$2); - var moveNorth$1 = doMove$2(cycleUp$1, moveUp); - var moveSouth$1 = doMove$2(cycleDown$1, moveDown); - var getKeydownRules$3 = constant([ - rule(inSet(LEFT), west$2(moveLeft$3, moveRight$3)), - rule(inSet(RIGHT), east$2(moveLeft$3, moveRight$3)), - rule(inSet(UP), north$2(moveNorth$1)), - rule(inSet(DOWN), south$2(moveSouth$1)), - rule(inSet(SPACE.concat(ENTER)), execute$4) - ]); - var getKeyupRules$3 = constant([rule(inSet(SPACE), stopEventForFirefox)]); - var MatrixType = typical(schema$7, NoState.init, getKeydownRules$3, getKeyupRules$3, function () { - return Optional.some(focusIn$2); - }); - - var schema$8 = [ - strict$1('selector'), - defaulted$1('execute', defaultExecute), - defaulted$1('moveOnTab', false) - ]; - var execute$5 = function (component, simulatedEvent, menuConfig) { - return menuConfig.focusManager.get(component).bind(function (focused) { - return menuConfig.execute(component, simulatedEvent, focused); - }); - }; - var focusIn$3 = function (component, menuConfig, _state) { - descendant$1(component.element, menuConfig.selector).each(function (first) { - menuConfig.focusManager.set(component, first); - }); - }; - var moveUp$1 = function (element, focused, info) { - return horizontal(element, info.selector, focused, -1); - }; - var moveDown$1 = function (element, focused, info) { - return horizontal(element, info.selector, focused, +1); - }; - var fireShiftTab = function (component, simulatedEvent, menuConfig, menuState) { - return menuConfig.moveOnTab ? move(moveUp$1)(component, simulatedEvent, menuConfig, menuState) : Optional.none(); - }; - var fireTab = function (component, simulatedEvent, menuConfig, menuState) { - return menuConfig.moveOnTab ? move(moveDown$1)(component, simulatedEvent, menuConfig, menuState) : Optional.none(); - }; - var getKeydownRules$4 = constant([ - rule(inSet(UP), move(moveUp$1)), - rule(inSet(DOWN), move(moveDown$1)), - rule(and([ - isShift, - inSet(TAB) - ]), fireShiftTab), - rule(and([ - isNotShift, - inSet(TAB) - ]), fireTab), - rule(inSet(ENTER), execute$5), - rule(inSet(SPACE), execute$5) - ]); - var getKeyupRules$4 = constant([rule(inSet(SPACE), stopEventForFirefox)]); - var MenuType = typical(schema$8, NoState.init, getKeydownRules$4, getKeyupRules$4, function () { - return Optional.some(focusIn$3); - }); - - var schema$9 = [ - onKeyboardHandler('onSpace'), - onKeyboardHandler('onEnter'), - onKeyboardHandler('onShiftEnter'), - onKeyboardHandler('onLeft'), - onKeyboardHandler('onRight'), - onKeyboardHandler('onTab'), - onKeyboardHandler('onShiftTab'), - onKeyboardHandler('onUp'), - onKeyboardHandler('onDown'), - onKeyboardHandler('onEscape'), - defaulted$1('stopSpaceKeyup', false), - option('focusIn') - ]; - var getKeydownRules$5 = function (component, simulatedEvent, specialInfo) { - return [ - rule(inSet(SPACE), specialInfo.onSpace), - rule(and([ - isNotShift, - inSet(ENTER) - ]), specialInfo.onEnter), - rule(and([ - isShift, - inSet(ENTER) - ]), specialInfo.onShiftEnter), - rule(and([ - isShift, - inSet(TAB) - ]), specialInfo.onShiftTab), - rule(and([ - isNotShift, - inSet(TAB) - ]), specialInfo.onTab), - rule(inSet(UP), specialInfo.onUp), - rule(inSet(DOWN), specialInfo.onDown), - rule(inSet(LEFT), specialInfo.onLeft), - rule(inSet(RIGHT), specialInfo.onRight), - rule(inSet(SPACE), specialInfo.onSpace), - rule(inSet(ESCAPE), specialInfo.onEscape) - ]; - }; - var getKeyupRules$5 = function (component, simulatedEvent, specialInfo) { - return specialInfo.stopSpaceKeyup ? [rule(inSet(SPACE), stopEventForFirefox)] : []; - }; - var SpecialType = typical(schema$9, NoState.init, getKeydownRules$5, getKeyupRules$5, function (specialInfo) { - return specialInfo.focusIn; - }); - - var acyclic = AcyclicType.schema(); - var cyclic = CyclicType.schema(); - var flow = FlowType.schema(); - var flatgrid$1 = FlatgridType.schema(); - var matrix = MatrixType.schema(); - var execution = ExecutionType.schema(); - var menu = MenuType.schema(); - var special = SpecialType.schema(); - - var KeyboardBranches = /*#__PURE__*/Object.freeze({ - __proto__: null, - acyclic: acyclic, - cyclic: cyclic, - flow: flow, - flatgrid: flatgrid$1, - matrix: matrix, - execution: execution, - menu: menu, - special: special - }); - - var isFlatgridState = function (keyState) { - return hasNonNullableKey(keyState, 'setGridSize'); - }; - var Keying = createModes$1({ - branchKey: 'mode', - branches: KeyboardBranches, - name: 'keying', - active: { - events: function (keyingConfig, keyingState) { - var handler = keyingConfig.handler; - return handler.toEvents(keyingConfig, keyingState); - } - }, - apis: { - focusIn: function (component, keyConfig, keyState) { - keyConfig.sendFocusIn(keyConfig).fold(function () { - component.getSystem().triggerFocus(component.element, component.element); - }, function (sendFocusIn) { - sendFocusIn(component, keyConfig, keyState); - }); - }, - setGridSize: function (component, keyConfig, keyState, numRows, numColumns) { - if (!isFlatgridState(keyState)) { - console.error('Layout does not support setGridSize'); - } else { - keyState.setGridSize(numRows, numColumns); - } - } - }, - state: KeyingState - }); - - var set$5 = function (component, replaceConfig, replaceState, data) { - preserve(function () { - var newChildren = map(data, component.getSystem().build); - replaceChildren(component, newChildren); - }, component.element); - }; - var insert = function (component, replaceConfig, insertion, childSpec) { - var child = component.getSystem().build(childSpec); - attachWith(component, child, insertion); - }; - var append$2 = function (component, replaceConfig, replaceState, appendee) { - insert(component, replaceConfig, append, appendee); - }; - var prepend$1 = function (component, replaceConfig, replaceState, prependee) { - insert(component, replaceConfig, prepend, prependee); - }; - var remove$7 = function (component, replaceConfig, replaceState, removee) { - var children = contents(component); - var foundChild = find(children, function (child) { - return eq$1(removee.element, child.element); - }); - foundChild.each(detach); - }; - var contents = function (component, _replaceConfig) { - return component.components(); - }; - var replaceAt = function (component, replaceConfig, replaceState, replaceeIndex, replacer) { - var children = contents(component); - return Optional.from(children[replaceeIndex]).map(function (replacee) { - remove$7(component, replaceConfig, replaceState, replacee); - replacer.each(function (r) { - insert(component, replaceConfig, function (p, c) { - appendAt(p, c, replaceeIndex); - }, r); - }); - return replacee; - }); - }; - var replaceBy = function (component, replaceConfig, replaceState, replaceePred, replacer) { - var children = contents(component); - return findIndex(children, replaceePred).bind(function (replaceeIndex) { - return replaceAt(component, replaceConfig, replaceState, replaceeIndex, replacer); - }); - }; - - var ReplaceApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - append: append$2, - prepend: prepend$1, - remove: remove$7, - replaceAt: replaceAt, - replaceBy: replaceBy, - set: set$5, - contents: contents - }); - - var Replacing = create$1({ - fields: [], - name: 'replacing', - apis: ReplaceApis - }); - - var events$4 = function (name, eventHandlers) { - var events = derive(eventHandlers); - return create$1({ - fields: [strict$1('enabled')], - name: name, - active: { events: constant(events) } - }); - }; - var config = function (name, eventHandlers) { - var me = events$4(name, eventHandlers); - return { - key: name, - value: { - config: {}, - me: me, - configAsRaw: constant({}), - initialConfig: {}, - state: NoState - } - }; - }; - - var focus$2 = function (component, focusConfig) { - if (!focusConfig.ignore) { - focus$1(component.element); - focusConfig.onFocus(component); - } - }; - var blur$1 = function (component, focusConfig) { - if (!focusConfig.ignore) { - blur(component.element); - } - }; - var isFocused = function (component) { - return hasFocus(component.element); - }; - - var FocusApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - focus: focus$2, - blur: blur$1, - isFocused: isFocused - }); - - var exhibit$1 = function (base, focusConfig) { - var mod = focusConfig.ignore ? {} : { attributes: { tabindex: '-1' } }; - return nu$6(mod); - }; - var events$5 = function (focusConfig) { - return derive([run(focus(), function (component, simulatedEvent) { - focus$2(component, focusConfig); - simulatedEvent.stop(); - })].concat(focusConfig.stopMousedown ? [run(mousedown(), function (_, simulatedEvent) { - simulatedEvent.event.prevent(); - })] : [])); - }; - - var ActiveFocus = /*#__PURE__*/Object.freeze({ - __proto__: null, - exhibit: exhibit$1, - events: events$5 - }); - - var FocusSchema = [ - onHandler('onFocus'), - defaulted$1('stopMousedown', false), - defaulted$1('ignore', false) - ]; - - var Focusing = create$1({ - fields: FocusSchema, - name: 'focusing', - active: ActiveFocus, - apis: FocusApis - }); - - var SetupBehaviourCellState = function (initialState) { - var init = function () { - var cell = Cell(initialState); - var get = function () { - return cell.get(); - }; - var set = function (newState) { - return cell.set(newState); - }; - var clear = function () { - return cell.set(initialState); - }; - var readState = function () { - return cell.get(); - }; - return { - get: get, - set: set, - clear: clear, - readState: readState - }; - }; - return { init: init }; - }; - - var updateAriaState = function (component, toggleConfig, toggleState) { - var ariaInfo = toggleConfig.aria; - ariaInfo.update(component, ariaInfo, toggleState.get()); - }; - var updateClass = function (component, toggleConfig, toggleState) { - toggleConfig.toggleClass.each(function (toggleClass) { - if (toggleState.get()) { - add$2(component.element, toggleClass); - } else { - remove$4(component.element, toggleClass); - } - }); - }; - var toggle = function (component, toggleConfig, toggleState) { - set$6(component, toggleConfig, toggleState, !toggleState.get()); - }; - var on$1 = function (component, toggleConfig, toggleState) { - toggleState.set(true); - updateClass(component, toggleConfig, toggleState); - updateAriaState(component, toggleConfig, toggleState); - }; - var off = function (component, toggleConfig, toggleState) { - toggleState.set(false); - updateClass(component, toggleConfig, toggleState); - updateAriaState(component, toggleConfig, toggleState); - }; - var set$6 = function (component, toggleConfig, toggleState, state) { - var action = state ? on$1 : off; - action(component, toggleConfig, toggleState); - }; - var isOn = function (component, toggleConfig, toggleState) { - return toggleState.get(); - }; - var onLoad$4 = function (component, toggleConfig, toggleState) { - set$6(component, toggleConfig, toggleState, toggleConfig.selected); - }; - - var ToggleApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - onLoad: onLoad$4, - toggle: toggle, - isOn: isOn, - on: on$1, - off: off, - set: set$6 - }); - - var exhibit$2 = function () { - return nu$6({}); - }; - var events$6 = function (toggleConfig, toggleState) { - var execute = executeEvent(toggleConfig, toggleState, toggle); - var load = loadEvent(toggleConfig, toggleState, onLoad$4); - return derive(flatten([ - toggleConfig.toggleOnExecute ? [execute] : [], - [load] - ])); - }; - - var ActiveToggle = /*#__PURE__*/Object.freeze({ - __proto__: null, - exhibit: exhibit$2, - events: events$6 - }); - - var updatePressed = function (component, ariaInfo, status) { - set$1(component.element, 'aria-pressed', status); - if (ariaInfo.syncWithExpanded) { - updateExpanded(component, ariaInfo, status); - } - }; - var updateSelected = function (component, ariaInfo, status) { - set$1(component.element, 'aria-selected', status); - }; - var updateChecked = function (component, ariaInfo, status) { - set$1(component.element, 'aria-checked', status); - }; - var updateExpanded = function (component, ariaInfo, status) { - set$1(component.element, 'aria-expanded', status); - }; - - var ToggleSchema = [ - defaulted$1('selected', false), - option('toggleClass'), - defaulted$1('toggleOnExecute', true), - defaultedOf('aria', { mode: 'none' }, choose$1('mode', { - pressed: [ - defaulted$1('syncWithExpanded', false), - output('update', updatePressed) - ], - checked: [output('update', updateChecked)], - expanded: [output('update', updateExpanded)], - selected: [output('update', updateSelected)], - none: [output('update', noop)] - })) - ]; - - var Toggling = create$1({ - fields: ToggleSchema, - name: 'toggling', - active: ActiveToggle, - apis: ToggleApis, - state: SetupBehaviourCellState(false) - }); - - var pointerEvents = function () { - var onClick = function (component, simulatedEvent) { - simulatedEvent.stop(); - emitExecute(component); - }; - return [ - run(click(), onClick), - run(tap(), onClick), - cutter(touchstart()), - cutter(mousedown()) - ]; - }; - var events$7 = function (optAction) { - var executeHandler = function (action) { - return runOnExecute(function (component, simulatedEvent) { - action(component); - simulatedEvent.stop(); - }); - }; - return derive(flatten([ - optAction.map(executeHandler).toArray(), - pointerEvents() - ])); - }; - - var hoverEvent = 'alloy.item-hover'; - var focusEvent = 'alloy.item-focus'; - var onHover = function (item) { - if (search(item.element).isNone() || Focusing.isFocused(item)) { - if (!Focusing.isFocused(item)) { - Focusing.focus(item); - } - emitWith(item, hoverEvent, { item: item }); - } - }; - var onFocus = function (item) { - emitWith(item, focusEvent, { item: item }); - }; - var hover = constant(hoverEvent); - var focus$3 = constant(focusEvent); - - var builder = function (detail) { - return { - dom: detail.dom, - domModification: __assign(__assign({}, detail.domModification), { attributes: __assign(__assign(__assign({ 'role': detail.toggling.isSome() ? 'menuitemcheckbox' : 'menuitem' }, detail.domModification.attributes), { 'aria-haspopup': detail.hasSubmenu }), detail.hasSubmenu ? { 'aria-expanded': false } : {}) }), - behaviours: SketchBehaviours.augment(detail.itemBehaviours, [ - detail.toggling.fold(Toggling.revoke, function (tConfig) { - return Toggling.config(__assign({ aria: { mode: 'checked' } }, tConfig)); - }), - Focusing.config({ - ignore: detail.ignoreFocus, - stopMousedown: detail.ignoreFocus, - onFocus: function (component) { - onFocus(component); - } - }), - Keying.config({ mode: 'execution' }), - Representing.config({ - store: { - mode: 'memory', - initialValue: detail.data - } - }), - config('item-type-events', __spreadArrays(pointerEvents(), [ - run(mouseover(), onHover), - run(focusItem(), Focusing.focus) - ])) - ]), - components: detail.components, - eventOrder: detail.eventOrder - }; - }; - var schema$a = [ - strict$1('data'), - strict$1('components'), - strict$1('dom'), - defaulted$1('hasSubmenu', false), - option('toggling'), - SketchBehaviours.field('itemBehaviours', [ - Toggling, - Focusing, - Keying, - Representing - ]), - defaulted$1('ignoreFocus', false), - defaulted$1('domModification', {}), - output('builder', builder), - defaulted$1('eventOrder', {}) - ]; - - var builder$1 = function (detail) { - return { - dom: detail.dom, - components: detail.components, - events: derive([stopper(focusItem())]) - }; - }; - var schema$b = [ - strict$1('dom'), - strict$1('components'), - output('builder', builder$1) - ]; - - var owner$2 = constant('item-widget'); - var parts = constant([required({ - name: 'widget', - overrides: function (detail) { - return { - behaviours: derive$1([Representing.config({ - store: { - mode: 'manual', - getValue: function (_component) { - return detail.data; - }, - setValue: noop - } - })]) - }; - } - })]); - - var builder$2 = function (detail) { - var subs = substitutes(owner$2(), detail, parts()); - var components$1 = components(owner$2(), detail, subs.internals()); - var focusWidget = function (component) { - return getPart(component, detail, 'widget').map(function (widget) { - Keying.focusIn(widget); - return widget; - }); - }; - var onHorizontalArrow = function (component, simulatedEvent) { - return inside(simulatedEvent.event.target) ? Optional.none() : function () { - if (detail.autofocus) { - simulatedEvent.setSource(component.element); - return Optional.none(); - } else { - return Optional.none(); - } - }(); - }; - return { - dom: detail.dom, - components: components$1, - domModification: detail.domModification, - events: derive([ - runOnExecute(function (component, simulatedEvent) { - focusWidget(component).each(function (_widget) { - simulatedEvent.stop(); - }); - }), - run(mouseover(), onHover), - run(focusItem(), function (component, _simulatedEvent) { - if (detail.autofocus) { - focusWidget(component); - } else { - Focusing.focus(component); - } - }) - ]), - behaviours: SketchBehaviours.augment(detail.widgetBehaviours, [ - Representing.config({ - store: { - mode: 'memory', - initialValue: detail.data - } - }), - Focusing.config({ - ignore: detail.ignoreFocus, - onFocus: function (component) { - onFocus(component); - } - }), - Keying.config({ - mode: 'special', - focusIn: detail.autofocus ? function (component) { - focusWidget(component); - } : revoke(), - onLeft: onHorizontalArrow, - onRight: onHorizontalArrow, - onEscape: function (component, simulatedEvent) { - if (!Focusing.isFocused(component) && !detail.autofocus) { - Focusing.focus(component); - return Optional.some(true); - } else if (detail.autofocus) { - simulatedEvent.setSource(component.element); - return Optional.none(); - } else { - return Optional.none(); - } - } - }) - ]) - }; - }; - var schema$c = [ - strict$1('uid'), - strict$1('data'), - strict$1('components'), - strict$1('dom'), - defaulted$1('autofocus', false), - defaulted$1('ignoreFocus', false), - SketchBehaviours.field('widgetBehaviours', [ - Representing, - Focusing, - Keying - ]), - defaulted$1('domModification', {}), - defaultUidsSchema(parts()), - output('builder', builder$2) - ]; - - var itemSchema$1 = choose$1('type', { - widget: schema$c, - item: schema$a, - separator: schema$b - }); - var configureGrid = function (detail, movementInfo) { - return { - mode: 'flatgrid', - selector: '.' + detail.markers.item, - initSize: { - numColumns: movementInfo.initSize.numColumns, - numRows: movementInfo.initSize.numRows - }, - focusManager: detail.focusManager - }; - }; - var configureMatrix = function (detail, movementInfo) { - return { - mode: 'matrix', - selectors: { - row: movementInfo.rowSelector, - cell: '.' + detail.markers.item - }, - focusManager: detail.focusManager - }; - }; - var configureMenu = function (detail, movementInfo) { - return { - mode: 'menu', - selector: '.' + detail.markers.item, - moveOnTab: movementInfo.moveOnTab, - focusManager: detail.focusManager - }; - }; - var parts$1 = constant([group({ - factory: { - sketch: function (spec) { - var itemInfo = asRawOrDie('menu.spec item', itemSchema$1, spec); - return itemInfo.builder(itemInfo); - } - }, - name: 'items', - unit: 'item', - defaults: function (detail, u) { - return u.hasOwnProperty('uid') ? u : __assign(__assign({}, u), { uid: generate$2('item') }); - }, - overrides: function (detail, u) { - return { - type: u.type, - ignoreFocus: detail.fakeFocus, - domModification: { classes: [detail.markers.item] } - }; - } - })]); - var schema$d = constant([ - strict$1('value'), - strict$1('items'), - strict$1('dom'), - strict$1('components'), - defaulted$1('eventOrder', {}), - field$1('menuBehaviours', [ - Highlighting, - Representing, - Composing, - Keying - ]), - defaultedOf('movement', { - mode: 'menu', - moveOnTab: true - }, choose$1('mode', { - grid: [ - initSize(), - output('config', configureGrid) - ], - matrix: [ - output('config', configureMatrix), - strict$1('rowSelector') - ], - menu: [ - defaulted$1('moveOnTab', true), - output('config', configureMenu) - ] - })), - itemMarkers(), - defaulted$1('fakeFocus', false), - defaulted$1('focusManager', dom()), - onHandler('onHighlight') - ]); - - var focus$4 = constant('alloy.menu-focus'); - - var make$1 = function (detail, components, _spec, _externals) { - return { - uid: detail.uid, - dom: detail.dom, - markers: detail.markers, - behaviours: augment(detail.menuBehaviours, [ - Highlighting.config({ - highlightClass: detail.markers.selectedItem, - itemClass: detail.markers.item, - onHighlight: detail.onHighlight - }), - Representing.config({ - store: { - mode: 'memory', - initialValue: detail.value - } - }), - Composing.config({ find: Optional.some }), - Keying.config(detail.movement.config(detail, detail.movement)) - ]), - events: derive([ - run(focus$3(), function (menu, simulatedEvent) { - var event = simulatedEvent.event; - menu.getSystem().getByDom(event.target).each(function (item) { - Highlighting.highlight(menu, item); - simulatedEvent.stop(); - emitWith(menu, focus$4(), { - menu: menu, - item: item - }); - }); - }), - run(hover(), function (menu, simulatedEvent) { - var item = simulatedEvent.event.item; - Highlighting.highlight(menu, item); - }) - ]), - components: components, - eventOrder: detail.eventOrder, - domModification: { attributes: { role: 'menu' } } - }; - }; - - var Menu = composite$1({ - name: 'Menu', - configFields: schema$d(), - partFields: parts$1(), - factory: make$1 - }); - - var transpose = function (obj) { - return tupleMap(obj, function (v, k) { - return { - k: v, - v: k - }; - }); - }; - var trace = function (items, byItem, byMenu, finish) { - return get$1(byMenu, finish).bind(function (triggerItem) { - return get$1(items, triggerItem).bind(function (triggerMenu) { - var rest = trace(items, byItem, byMenu, triggerMenu); - return Optional.some([triggerMenu].concat(rest)); - }); - }).getOr([]); - }; - var generate$5 = function (menus, expansions) { - var items = {}; - each$1(menus, function (menuItems, menu) { - each(menuItems, function (item) { - items[item] = menu; - }); - }); - var byItem = expansions; - var byMenu = transpose(expansions); - var menuPaths = map$2(byMenu, function (_triggerItem, submenu) { - return [submenu].concat(trace(items, byItem, byMenu, submenu)); - }); - return map$2(items, function (menu) { - return get$1(menuPaths, menu).getOr([menu]); - }); - }; - - var init$3 = function () { - var expansions = Cell({}); - var menus = Cell({}); - var paths = Cell({}); - var primary = Cell(Optional.none()); - var directory = Cell({}); - var clear = function () { - expansions.set({}); - menus.set({}); - paths.set({}); - primary.set(Optional.none()); - }; - var isClear = function () { - return primary.get().isNone(); - }; - var setMenuBuilt = function (menuName, built) { - var _a; - menus.set(__assign(__assign({}, menus.get()), (_a = {}, _a[menuName] = { - type: 'prepared', - menu: built - }, _a))); - }; - var setContents = function (sPrimary, sMenus, sExpansions, dir) { - primary.set(Optional.some(sPrimary)); - expansions.set(sExpansions); - menus.set(sMenus); - directory.set(dir); - var sPaths = generate$5(dir, sExpansions); - paths.set(sPaths); - }; - var getTriggeringItem = function (menuValue) { - return find$1(expansions.get(), function (v, _k) { - return v === menuValue; - }); - }; - var getTriggerData = function (menuValue, getItemByValue, path) { - return getPreparedMenu(menuValue).bind(function (menu) { - return getTriggeringItem(menuValue).bind(function (triggeringItemValue) { - return getItemByValue(triggeringItemValue).map(function (triggeredItem) { - return { - triggeredMenu: menu, - triggeringItem: triggeredItem, - triggeringPath: path - }; - }); - }); - }); - }; - var getTriggeringPath = function (itemValue, getItemByValue) { - var extraPath = filter(lookupItem(itemValue).toArray(), function (menuValue) { - return getPreparedMenu(menuValue).isSome(); - }); - return get$1(paths.get(), itemValue).bind(function (path) { - var revPath = reverse(extraPath.concat(path)); - var triggers = bind(revPath, function (menuValue, menuIndex) { - return getTriggerData(menuValue, getItemByValue, revPath.slice(0, menuIndex + 1)).fold(function () { - return primary.get().is(menuValue) ? [] : [Optional.none()]; - }, function (data) { - return [Optional.some(data)]; - }); - }); - return sequence(triggers); - }); - }; - var expand = function (itemValue) { - return get$1(expansions.get(), itemValue).map(function (menu) { - var current = get$1(paths.get(), itemValue).getOr([]); - return [menu].concat(current); - }); - }; - var collapse = function (itemValue) { - return get$1(paths.get(), itemValue).bind(function (path) { - return path.length > 1 ? Optional.some(path.slice(1)) : Optional.none(); - }); - }; - var refresh = function (itemValue) { - return get$1(paths.get(), itemValue); - }; - var getPreparedMenu = function (menuValue) { - return lookupMenu(menuValue).bind(extractPreparedMenu); - }; - var lookupMenu = function (menuValue) { - return get$1(menus.get(), menuValue); - }; - var lookupItem = function (itemValue) { - return get$1(expansions.get(), itemValue); - }; - var otherMenus = function (path) { - var menuValues = directory.get(); - return difference(keys(menuValues), path); - }; - var getPrimary = function () { - return primary.get().bind(getPreparedMenu); - }; - var getMenus = function () { - return menus.get(); - }; - return { - setMenuBuilt: setMenuBuilt, - setContents: setContents, - expand: expand, - refresh: refresh, - collapse: collapse, - lookupMenu: lookupMenu, - lookupItem: lookupItem, - otherMenus: otherMenus, - getPrimary: getPrimary, - getMenus: getMenus, - clear: clear, - isClear: isClear, - getTriggeringPath: getTriggeringPath - }; - }; - var extractPreparedMenu = function (prep) { - return prep.type === 'prepared' ? Optional.some(prep.menu) : Optional.none(); - }; - var LayeredState = { - init: init$3, - extractPreparedMenu: extractPreparedMenu - }; - - var make$2 = function (detail, _rawUiSpec) { - var submenuParentItems = Cell(Optional.none()); - var buildMenus = function (container, primaryName, menus) { - return map$2(menus, function (spec, name) { - var makeSketch = function () { - return Menu.sketch(__assign(__assign({}, spec), { - value: name, - markers: detail.markers, - fakeFocus: detail.fakeFocus, - onHighlight: detail.onHighlight, - focusManager: detail.fakeFocus ? highlights() : dom() - })); - }; - return name === primaryName ? { - type: 'prepared', - menu: container.getSystem().build(makeSketch()) - } : { - type: 'notbuilt', - nbMenu: makeSketch - }; - }); - }; - var layeredState = LayeredState.init(); - var setup = function (container) { - var componentMap = buildMenus(container, detail.data.primary, detail.data.menus); - var directory = toDirectory(); - layeredState.setContents(detail.data.primary, componentMap, detail.data.expansions, directory); - return layeredState.getPrimary(); - }; - var getItemValue = function (item) { - return Representing.getValue(item).value; - }; - var getItemByValue = function (_container, menus, itemValue) { - return findMap(menus, function (menu) { - if (!menu.getSystem().isConnected()) { - return Optional.none(); - } - var candidates = Highlighting.getCandidates(menu); - return find(candidates, function (c) { - return getItemValue(c) === itemValue; - }); - }); - }; - var toDirectory = function (_container) { - return map$2(detail.data.menus, function (data, _menuName) { - return bind(data.items, function (item) { - return item.type === 'separator' ? [] : [item.data.value]; - }); - }); - }; - var setActiveMenu = function (container, menu) { - Highlighting.highlight(container, menu); - Highlighting.getHighlighted(menu).orThunk(function () { - return Highlighting.getFirst(menu); - }).each(function (item) { - dispatch(container, item.element, focusItem()); - }); - }; - var getMenus = function (state, menuValues) { - return cat(map(menuValues, function (mv) { - return state.lookupMenu(mv).bind(function (prep) { - return prep.type === 'prepared' ? Optional.some(prep.menu) : Optional.none(); - }); - })); - }; - var closeOthers = function (container, state, path) { - var others = getMenus(state, state.otherMenus(path)); - each(others, function (o) { - remove$5(o.element, [detail.markers.backgroundMenu]); - if (!detail.stayInDom) { - Replacing.remove(container, o); - } - }); - }; - var getSubmenuParents = function (container) { - return submenuParentItems.get().getOrThunk(function () { - var r = {}; - var items = descendants(container.element, '.' + detail.markers.item); - var parentItems = filter(items, function (i) { - return get$3(i, 'aria-haspopup') === 'true'; - }); - each(parentItems, function (i) { - container.getSystem().getByDom(i).each(function (itemComp) { - var key = getItemValue(itemComp); - r[key] = itemComp; - }); - }); - submenuParentItems.set(Optional.some(r)); - return r; - }); - }; - var updateAriaExpansions = function (container, path) { - var parentItems = getSubmenuParents(container); - each$1(parentItems, function (v, k) { - var expanded = contains(path, k); - set$1(v.element, 'aria-expanded', expanded); - }); - }; - var updateMenuPath = function (container, state, path) { - return Optional.from(path[0]).bind(function (latestMenuName) { - return state.lookupMenu(latestMenuName).bind(function (menuPrep) { - if (menuPrep.type === 'notbuilt') { - return Optional.none(); - } else { - var activeMenu = menuPrep.menu; - var rest = getMenus(state, path.slice(1)); - each(rest, function (r) { - add$2(r.element, detail.markers.backgroundMenu); - }); - if (!inBody(activeMenu.element)) { - Replacing.append(container, premade$1(activeMenu)); - } - remove$5(activeMenu.element, [detail.markers.backgroundMenu]); - setActiveMenu(container, activeMenu); - closeOthers(container, state, path); - return Optional.some(activeMenu); - } - }); - }); - }; - var ExpandHighlightDecision; - (function (ExpandHighlightDecision) { - ExpandHighlightDecision[ExpandHighlightDecision['HighlightSubmenu'] = 0] = 'HighlightSubmenu'; - ExpandHighlightDecision[ExpandHighlightDecision['HighlightParent'] = 1] = 'HighlightParent'; - }(ExpandHighlightDecision || (ExpandHighlightDecision = {}))); - var buildIfRequired = function (container, menuName, menuPrep) { - if (menuPrep.type === 'notbuilt') { - var menu = container.getSystem().build(menuPrep.nbMenu()); - layeredState.setMenuBuilt(menuName, menu); - return menu; - } else { - return menuPrep.menu; - } - }; - var expandRight = function (container, item, decision) { - if (decision === void 0) { - decision = ExpandHighlightDecision.HighlightSubmenu; - } - var value = getItemValue(item); - return layeredState.expand(value).bind(function (path) { - updateAriaExpansions(container, path); - return Optional.from(path[0]).bind(function (menuName) { - return layeredState.lookupMenu(menuName).bind(function (activeMenuPrep) { - var activeMenu = buildIfRequired(container, menuName, activeMenuPrep); - if (!inBody(activeMenu.element)) { - Replacing.append(container, premade$1(activeMenu)); - } - detail.onOpenSubmenu(container, item, activeMenu, reverse(path)); - if (decision === ExpandHighlightDecision.HighlightSubmenu) { - Highlighting.highlightFirst(activeMenu); - return updateMenuPath(container, layeredState, path); - } else { - Highlighting.dehighlightAll(activeMenu); - return Optional.some(item); - } - }); - }); - }); - }; - var collapseLeft = function (container, item) { - var value = getItemValue(item); - return layeredState.collapse(value).bind(function (path) { - updateAriaExpansions(container, path); - return updateMenuPath(container, layeredState, path).map(function (activeMenu) { - detail.onCollapseMenu(container, item, activeMenu); - return activeMenu; - }); - }); - }; - var updateView = function (container, item) { - var value = getItemValue(item); - return layeredState.refresh(value).bind(function (path) { - updateAriaExpansions(container, path); - return updateMenuPath(container, layeredState, path); - }); - }; - var onRight = function (container, item) { - return inside(item.element) ? Optional.none() : expandRight(container, item, ExpandHighlightDecision.HighlightSubmenu); - }; - var onLeft = function (container, item) { - return inside(item.element) ? Optional.none() : collapseLeft(container, item); - }; - var onEscape = function (container, item) { - return collapseLeft(container, item).orThunk(function () { - return detail.onEscape(container, item).map(function () { - return container; - }); - }); - }; - var keyOnItem = function (f) { - return function (container, simulatedEvent) { - return closest$3(simulatedEvent.getSource(), '.' + detail.markers.item).bind(function (target) { - return container.getSystem().getByDom(target).toOptional().bind(function (item) { - return f(container, item).map(always); - }); - }); - }; - }; - var events = derive([ - run(focus$4(), function (sandbox, simulatedEvent) { - var item = simulatedEvent.event.item; - layeredState.lookupItem(getItemValue(item)).each(function () { - var menu = simulatedEvent.event.menu; - Highlighting.highlight(sandbox, menu); - var value = getItemValue(simulatedEvent.event.item); - layeredState.refresh(value).each(function (path) { - return closeOthers(sandbox, layeredState, path); - }); - }); - }), - runOnExecute(function (component, simulatedEvent) { - var target = simulatedEvent.event.target; - component.getSystem().getByDom(target).each(function (item) { - var itemValue = getItemValue(item); - if (itemValue.indexOf('collapse-item') === 0) { - collapseLeft(component, item); - } - expandRight(component, item, ExpandHighlightDecision.HighlightSubmenu).fold(function () { - detail.onExecute(component, item); - }, noop); - }); - }), - runOnAttached(function (container, _simulatedEvent) { - setup(container).each(function (primary) { - Replacing.append(container, premade$1(primary)); - detail.onOpenMenu(container, primary); - if (detail.highlightImmediately) { - setActiveMenu(container, primary); - } - }); - }) - ].concat(detail.navigateOnHover ? [run(hover(), function (sandbox, simulatedEvent) { - var item = simulatedEvent.event.item; - updateView(sandbox, item); - expandRight(sandbox, item, ExpandHighlightDecision.HighlightParent); - detail.onHover(sandbox, item); - })] : [])); - var getActiveItem = function (container) { - return Highlighting.getHighlighted(container).bind(Highlighting.getHighlighted); - }; - var collapseMenuApi = function (container) { - getActiveItem(container).each(function (currentItem) { - collapseLeft(container, currentItem); - }); - }; - var highlightPrimary = function (container) { - layeredState.getPrimary().each(function (primary) { - setActiveMenu(container, primary); - }); - }; - var extractMenuFromContainer = function (container) { - return Optional.from(container.components()[0]).filter(function (comp) { - return get$3(comp.element, 'role') === 'menu'; - }); - }; - var repositionMenus = function (container) { - var maybeActivePrimary = layeredState.getPrimary().bind(function (primary) { - return getActiveItem(container).bind(function (currentItem) { - var itemValue = getItemValue(currentItem); - var allMenus = values(layeredState.getMenus()); - var preparedMenus = cat(map(allMenus, LayeredState.extractPreparedMenu)); - return layeredState.getTriggeringPath(itemValue, function (v) { - return getItemByValue(container, preparedMenus, v); - }); - }).map(function (triggeringPath) { - return { - primary: primary, - triggeringPath: triggeringPath - }; - }); - }); - maybeActivePrimary.fold(function () { - extractMenuFromContainer(container).each(function (primaryMenu) { - detail.onRepositionMenu(container, primaryMenu, []); - }); - }, function (_a) { - var primary = _a.primary, triggeringPath = _a.triggeringPath; - detail.onRepositionMenu(container, primary, triggeringPath); - }); - }; - var apis = { - collapseMenu: collapseMenuApi, - highlightPrimary: highlightPrimary, - repositionMenus: repositionMenus - }; - return { - uid: detail.uid, - dom: detail.dom, - markers: detail.markers, - behaviours: augment(detail.tmenuBehaviours, [ - Keying.config({ - mode: 'special', - onRight: keyOnItem(onRight), - onLeft: keyOnItem(onLeft), - onEscape: keyOnItem(onEscape), - focusIn: function (container, _keyInfo) { - layeredState.getPrimary().each(function (primary) { - dispatch(container, primary.element, focusItem()); - }); - } - }), - Highlighting.config({ - highlightClass: detail.markers.selectedMenu, - itemClass: detail.markers.menu - }), - Composing.config({ - find: function (container) { - return Highlighting.getHighlighted(container); - } - }), - Replacing.config({}) - ]), - eventOrder: detail.eventOrder, - apis: apis, - events: events - }; - }; - var collapseItem = constant('collapse-item'); - - var tieredData = function (primary, menus, expansions) { - return { - primary: primary, - menus: menus, - expansions: expansions - }; - }; - var singleData = function (name, menu) { - return { - primary: name, - menus: wrap$1(name, menu), - expansions: {} - }; - }; - var collapseItem$1 = function (text) { - return { - value: generate$1(collapseItem()), - meta: { text: text } - }; - }; - var tieredMenu = single$2({ - name: 'TieredMenu', - configFields: [ - onStrictKeyboardHandler('onExecute'), - onStrictKeyboardHandler('onEscape'), - onStrictHandler('onOpenMenu'), - onStrictHandler('onOpenSubmenu'), - onHandler('onRepositionMenu'), - onHandler('onCollapseMenu'), - defaulted$1('highlightImmediately', true), - strictObjOf('data', [ - strict$1('primary'), - strict$1('menus'), - strict$1('expansions') - ]), - defaulted$1('fakeFocus', false), - onHandler('onHighlight'), - onHandler('onHover'), - tieredMenuMarkers(), - strict$1('dom'), - defaulted$1('navigateOnHover', true), - defaulted$1('stayInDom', false), - field$1('tmenuBehaviours', [ - Keying, - Highlighting, - Composing, - Replacing - ]), - defaulted$1('eventOrder', {}) - ], - apis: { - collapseMenu: function (apis, tmenu) { - apis.collapseMenu(tmenu); - }, - highlightPrimary: function (apis, tmenu) { - apis.highlightPrimary(tmenu); - }, - repositionMenus: function (apis, tmenu) { - apis.repositionMenus(tmenu); - } - }, - factory: make$2, - extraApis: { - tieredData: tieredData, - singleData: singleData, - collapseItem: collapseItem$1 - } - }); - - var makeMenu = function (detail, menuSandbox, anchor, menuSpec, getBounds) { - var lazySink = function () { - return detail.lazySink(menuSandbox); - }; - var layouts = menuSpec.type === 'horizontal' ? { - layouts: { - onLtr: function () { - return belowOrAbove(); - }, - onRtl: function () { - return belowOrAboveRtl(); - } - } - } : {}; - var isFirstTierSubmenu = function (triggeringPaths) { - return triggeringPaths.length === 2; - }; - var getSubmenuLayouts = function (triggeringPaths) { - return isFirstTierSubmenu(triggeringPaths) ? layouts : {}; - }; - return tieredMenu.sketch({ - dom: { tag: 'div' }, - data: menuSpec.data, - markers: menuSpec.menu.markers, - highlightImmediately: menuSpec.menu.highlightImmediately, - onEscape: function () { - Sandboxing.close(menuSandbox); - detail.onEscape.map(function (handler) { - return handler(menuSandbox); - }); - return Optional.some(true); - }, - onExecute: function () { - return Optional.some(true); - }, - onOpenMenu: function (tmenu, menu) { - Positioning.positionWithinBounds(lazySink().getOrDie(), anchor, menu, getBounds()); - }, - onOpenSubmenu: function (tmenu, item, submenu, triggeringPaths) { - var sink = lazySink().getOrDie(); - Positioning.position(sink, __assign({ - anchor: 'submenu', - item: item - }, getSubmenuLayouts(triggeringPaths)), submenu); - }, - onRepositionMenu: function (tmenu, primaryMenu, submenuTriggers) { - var sink = lazySink().getOrDie(); - Positioning.positionWithinBounds(sink, anchor, primaryMenu, getBounds()); - each(submenuTriggers, function (st) { - var submenuLayouts = getSubmenuLayouts(st.triggeringPath); - Positioning.position(sink, __assign({ - anchor: 'submenu', - item: st.triggeringItem - }, submenuLayouts), st.triggeredMenu); - }); - } - }); - }; - var factory = function (detail, spec) { - var isPartOfRelated = function (sandbox, queryElem) { - var related = detail.getRelated(sandbox); - return related.exists(function (rel) { - return isPartOf(rel, queryElem); - }); - }; - var setContent = function (sandbox, thing) { - Sandboxing.setContent(sandbox, thing); - }; - var showAt = function (sandbox, anchor, thing) { - showWithin(sandbox, anchor, thing, Optional.none()); - }; - var showWithin = function (sandbox, anchor, thing, boxElement) { - showWithinBounds(sandbox, anchor, thing, function () { - return boxElement.map(function (elem) { - return box(elem); - }); - }); - }; - var showWithinBounds = function (sandbox, anchor, thing, getBounds) { - var sink = detail.lazySink(sandbox).getOrDie(); - Sandboxing.openWhileCloaked(sandbox, thing, function () { - return Positioning.positionWithinBounds(sink, anchor, sandbox, getBounds()); - }); - Representing.setValue(sandbox, Optional.some({ - mode: 'position', - anchor: anchor, - getBounds: getBounds - })); - }; - var showMenuAt = function (sandbox, anchor, menuSpec) { - showMenuWithinBounds(sandbox, anchor, menuSpec, function () { - return Optional.none(); - }); - }; - var showMenuWithinBounds = function (sandbox, anchor, menuSpec, getBounds) { - var menu = makeMenu(detail, sandbox, anchor, menuSpec, getBounds); - Sandboxing.open(sandbox, menu); - Representing.setValue(sandbox, Optional.some({ - mode: 'menu', - menu: menu - })); - }; - var hide = function (sandbox) { - if (Sandboxing.isOpen(sandbox)) { - Representing.setValue(sandbox, Optional.none()); - Sandboxing.close(sandbox); - } - }; - var getContent = function (sandbox) { - return Sandboxing.getState(sandbox); - }; - var reposition = function (sandbox) { - if (Sandboxing.isOpen(sandbox)) { - Representing.getValue(sandbox).each(function (state) { - switch (state.mode) { - case 'menu': - Sandboxing.getState(sandbox).each(function (tmenu) { - tieredMenu.repositionMenus(tmenu); - }); - break; - case 'position': - var sink = detail.lazySink(sandbox).getOrDie(); - Positioning.positionWithinBounds(sink, state.anchor, sandbox, state.getBounds()); - break; - } - }); - } - }; - var apis = { - setContent: setContent, - showAt: showAt, - showWithin: showWithin, - showWithinBounds: showWithinBounds, - showMenuAt: showMenuAt, - showMenuWithinBounds: showMenuWithinBounds, - hide: hide, - getContent: getContent, - reposition: reposition, - isOpen: Sandboxing.isOpen - }; - return { - uid: detail.uid, - dom: detail.dom, - behaviours: augment(detail.inlineBehaviours, [ - Sandboxing.config({ - isPartOf: function (sandbox, data, queryElem) { - return isPartOf(data, queryElem) || isPartOfRelated(sandbox, queryElem); - }, - getAttachPoint: function (sandbox) { - return detail.lazySink(sandbox).getOrDie(); - }, - onOpen: function (sandbox) { - detail.onShow(sandbox); - }, - onClose: function (sandbox) { - detail.onHide(sandbox); - } - }), - Representing.config({ - store: { - mode: 'memory', - initialValue: Optional.none() - } - }), - Receiving.config({ - channels: __assign(__assign({}, receivingChannel(__assign({ isExtraPart: spec.isExtraPart }, detail.fireDismissalEventInstead.map(function (fe) { - return { fireEventInstead: { event: fe.event } }; - }).getOr({})))), receivingChannel$1(__assign(__assign({}, detail.fireRepositionEventInstead.map(function (fe) { - return { fireEventInstead: { event: fe.event } }; - }).getOr({})), { doReposition: reposition }))) - }) - ]), - eventOrder: detail.eventOrder, - apis: apis - }; - }; - var InlineView = single$2({ - name: 'InlineView', - configFields: [ - strict$1('lazySink'), - onHandler('onShow'), - onHandler('onHide'), - optionFunction('onEscape'), - field$1('inlineBehaviours', [ - Sandboxing, - Representing, - Receiving - ]), - optionObjOf('fireDismissalEventInstead', [defaulted$1('event', dismissRequested())]), - optionObjOf('fireRepositionEventInstead', [defaulted$1('event', repositionRequested())]), - defaulted$1('getRelated', Optional.none), - defaulted$1('isExtraPart', never), - defaulted$1('eventOrder', Optional.none) - ], - factory: factory, - apis: { - showAt: function (apis, component, anchor, thing) { - apis.showAt(component, anchor, thing); - }, - showWithin: function (apis, component, anchor, thing, boxElement) { - apis.showWithin(component, anchor, thing, boxElement); - }, - showWithinBounds: function (apis, component, anchor, thing, bounds) { - apis.showWithinBounds(component, anchor, thing, bounds); - }, - showMenuAt: function (apis, component, anchor, menuSpec) { - apis.showMenuAt(component, anchor, menuSpec); - }, - showMenuWithinBounds: function (apis, component, anchor, menuSpec, bounds) { - apis.showMenuWithinBounds(component, anchor, menuSpec, bounds); - }, - hide: function (apis, component) { - apis.hide(component); - }, - isOpen: function (apis, component) { - return apis.isOpen(component); - }, - getContent: function (apis, component) { - return apis.getContent(component); - }, - setContent: function (apis, component, thing) { - apis.setContent(component, thing); - }, - reposition: function (apis, component) { - apis.reposition(component); - } - } - }); - - var westEdgeX$1 = function (anchor) { - return anchor.x; - }; - var middleX$1 = function (anchor, element) { - return anchor.x + anchor.width / 2 - element.width / 2; - }; - var eastEdgeX$1 = function (anchor, element) { - return anchor.x + anchor.width - element.width; - }; - var northY$2 = function (anchor) { - return anchor.y; - }; - var southY$2 = function (anchor, element) { - return anchor.y + anchor.height - element.height; - }; - var southeast$3 = function (anchor, element, bubbles) { - return nu$7(eastEdgeX$1(anchor, element), southY$2(anchor, element), bubbles.innerSoutheast(), northwest(), boundsRestriction(anchor, { - right: 0, - bottom: 3 - }), 'layout-inner-se'); - }; - var southwest$3 = function (anchor, element, bubbles) { - return nu$7(westEdgeX$1(anchor), southY$2(anchor, element), bubbles.innerSouthwest(), northeast(), boundsRestriction(anchor, { - left: 1, - bottom: 3 - }), 'layout-inner-sw'); - }; - var northeast$3 = function (anchor, element, bubbles) { - return nu$7(eastEdgeX$1(anchor, element), northY$2(anchor), bubbles.innerNortheast(), southwest(), boundsRestriction(anchor, { - right: 0, - top: 2 - }), 'layout-inner-ne'); - }; - var northwest$3 = function (anchor, element, bubbles) { - return nu$7(westEdgeX$1(anchor), northY$2(anchor), bubbles.innerNorthwest(), southeast(), boundsRestriction(anchor, { - left: 1, - top: 2 - }), 'layout-inner-nw'); - }; - var north$3 = function (anchor, element, bubbles) { - return nu$7(middleX$1(anchor, element), northY$2(anchor), bubbles.innerNorth(), south(), boundsRestriction(anchor, { top: 2 }), 'layout-inner-n'); - }; - var south$3 = function (anchor, element, bubbles) { - return nu$7(middleX$1(anchor, element), southY$2(anchor, element), bubbles.innerSouth(), north(), boundsRestriction(anchor, { bottom: 3 }), 'layout-inner-s'); - }; - - var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay'); - - var factory$1 = function (detail) { - var events = events$7(detail.action); - var tag = detail.dom.tag; - var lookupAttr = function (attr) { - return get$1(detail.dom, 'attributes').bind(function (attrs) { - return get$1(attrs, attr); - }); - }; - var getModAttributes = function () { - if (tag === 'button') { - var type = lookupAttr('type').getOr('button'); - var roleAttrs = lookupAttr('role').map(function (role) { - return { role: role }; - }).getOr({}); - return __assign({ type: type }, roleAttrs); - } else { - var role = lookupAttr('role').getOr('button'); - return { role: role }; - } - }; - return { - uid: detail.uid, - dom: detail.dom, - components: detail.components, - events: events, - behaviours: SketchBehaviours.augment(detail.buttonBehaviours, [ - Focusing.config({}), - Keying.config({ - mode: 'execution', - useSpace: true, - useEnter: true - }) - ]), - domModification: { attributes: getModAttributes() }, - eventOrder: detail.eventOrder - }; - }; - var Button = single$2({ - name: 'Button', - factory: factory$1, - configFields: [ - defaulted$1('uid', undefined), - strict$1('dom'), - defaulted$1('components', []), - SketchBehaviours.field('buttonBehaviours', [ - Focusing, - Keying - ]), - option('action'), - option('role'), - defaulted$1('eventOrder', {}) - ] - }); - - var record = function (spec) { - var uid = isSketchSpec(spec) && hasNonNullableKey(spec, 'uid') ? spec.uid : generate$2('memento'); - var get = function (anyInSystem) { - return anyInSystem.getSystem().getByUid(uid).getOrDie(); - }; - var getOpt = function (anyInSystem) { - return anyInSystem.getSystem().getByUid(uid).toOptional(); - }; - var asSpec = function () { - return __assign(__assign({}, spec), { uid: uid }); - }; - return { - get: get, - getOpt: getOpt, - asSpec: asSpec - }; - }; - - var defaultIcon = function (icons) { - return Optional.from(icons()['temporary-placeholder']).getOr('!not found!'); - }; - var get$e = function (name, icons) { - return Optional.from(icons()[name.toLowerCase()]).getOrThunk(function () { - return defaultIcon(icons); - }); - }; - var getOr = function (name, icons, fallback) { - return Optional.from(icons()[name.toLowerCase()]).or(fallback).getOrThunk(function () { - return defaultIcon(icons); - }); - }; - var getFirst$1 = function (names, icons) { - return findMap(names, function (name) { - return Optional.from(icons()[name.toLowerCase()]); - }).getOrThunk(function () { - return defaultIcon(icons); - }); - }; - - var notificationIconMap = { - success: 'checkmark', - error: 'warning', - err: 'error', - warning: 'warning', - warn: 'warning', - info: 'info' - }; - var factory$2 = function (detail) { - var memBannerText = record({ - dom: { - tag: 'p', - innerHtml: detail.translationProvider(detail.text) - }, - behaviours: derive$1([Replacing.config({})]) - }); - var renderPercentBar = function (percent) { - return { - dom: { - tag: 'div', - classes: ['tox-bar'], - attributes: { style: 'width: ' + percent + '%' } - } - }; - }; - var renderPercentText = function (percent) { - return { - dom: { - tag: 'div', - classes: ['tox-text'], - innerHtml: percent + '%' - } - }; - }; - var memBannerProgress = record({ - dom: { - tag: 'div', - classes: detail.progress ? [ - 'tox-progress-bar', - 'tox-progress-indicator' - ] : ['tox-progress-bar'] - }, - components: [ - { - dom: { - tag: 'div', - classes: ['tox-bar-container'] - }, - components: [renderPercentBar(0)] - }, - renderPercentText(0) - ], - behaviours: derive$1([Replacing.config({})]) - }); - var updateProgress = function (comp, percent) { - if (comp.getSystem().isConnected()) { - memBannerProgress.getOpt(comp).each(function (progress) { - Replacing.set(progress, [ - { - dom: { - tag: 'div', - classes: ['tox-bar-container'] - }, - components: [renderPercentBar(percent)] - }, - renderPercentText(percent) - ]); - }); - } - }; - var updateText = function (comp, text$1) { - if (comp.getSystem().isConnected()) { - var banner = memBannerText.get(comp); - Replacing.set(banner, [text(text$1)]); - } - }; - var apis = { - updateProgress: updateProgress, - updateText: updateText - }; - var iconChoices = flatten([ - detail.icon.toArray(), - detail.level.toArray(), - detail.level.bind(function (level) { - return Optional.from(notificationIconMap[level]); - }).toArray() - ]); - var memButton = record(Button.sketch({ - dom: { - tag: 'button', - classes: [ - 'tox-notification__dismiss', - 'tox-button', - 'tox-button--naked', - 'tox-button--icon' - ] - }, - components: [{ - dom: { - tag: 'div', - classes: ['tox-icon'], - innerHtml: get$e('close', detail.iconProvider), - attributes: { 'aria-label': detail.translationProvider('Close') } - } - }], - action: function (comp) { - detail.onAction(comp); - } - })); - var components = [ - { - dom: { - tag: 'div', - classes: ['tox-notification__icon'], - innerHtml: getFirst$1(iconChoices, detail.iconProvider) - } - }, - { - dom: { - tag: 'div', - classes: ['tox-notification__body'] - }, - components: [memBannerText.asSpec()], - behaviours: derive$1([Replacing.config({})]) - } - ]; - return { - uid: detail.uid, - dom: { - tag: 'div', - attributes: { role: 'alert' }, - classes: detail.level.map(function (level) { - return [ - 'tox-notification', - 'tox-notification--in', - 'tox-notification--' + level - ]; - }).getOr([ - 'tox-notification', - 'tox-notification--in' - ]) - }, - behaviours: derive$1([ - Focusing.config({}), - config('notification-events', [run(focusin(), function (comp) { - memButton.getOpt(comp).each(Focusing.focus); - })]) - ]), - components: components.concat(detail.progress ? [memBannerProgress.asSpec()] : []).concat(!detail.closeButton ? [] : [memButton.asSpec()]), - apis: apis - }; - }; - var Notification = single$2({ - name: 'Notification', - factory: factory$2, - configFields: [ - option('level'), - strict$1('progress'), - strict$1('icon'), - strict$1('onAction'), - strict$1('text'), - strict$1('iconProvider'), - strict$1('translationProvider'), - defaultedBoolean('closeButton', true) - ], - apis: { - updateProgress: function (apis, comp, percent) { - apis.updateProgress(comp, percent); - }, - updateText: function (apis, comp, text) { - apis.updateText(comp, text); - } - } - }); - - function NotificationManagerImpl (editor, extras, uiMothership) { - var backstage = extras.backstage; - var getLayoutDirection = function (rel) { - switch (rel) { - case 'bc-bc': - return south$3; - case 'tc-tc': - return north$3; - case 'tc-bc': - return north$1; - case 'bc-tc': - default: - return south$1; - } - }; - var prePositionNotifications = function (notifications) { - each(notifications, function (notification) { - return notification.moveTo(0, 0); - }); - }; - var positionNotifications = function (notifications) { - if (notifications.length > 0) { - head(notifications).each(function (firstItem) { - return firstItem.moveRel(null, 'banner'); - }); - each(notifications, function (notification, index) { - if (index > 0) { - notification.moveRel(notifications[index - 1].getEl(), 'bc-tc'); - } - }); - } - }; - var reposition = function (notifications) { - prePositionNotifications(notifications); - positionNotifications(notifications); - }; - var open = function (settings, closeCallback) { - var hideCloseButton = !settings.closeButton && settings.timeout && (settings.timeout > 0 || settings.timeout < 0); - var close = function () { - closeCallback(); - InlineView.hide(notificationWrapper); - }; - var notification = build$1(Notification.sketch({ - text: settings.text, - level: contains([ - 'success', - 'error', - 'warning', - 'warn', - 'info' - ], settings.type) ? settings.type : undefined, - progress: settings.progressBar === true, - icon: Optional.from(settings.icon), - closeButton: !hideCloseButton, - onAction: close, - iconProvider: backstage.shared.providers.icons, - translationProvider: backstage.shared.providers.translate - })); - var notificationWrapper = build$1(InlineView.sketch(__assign({ - dom: { - tag: 'div', - classes: ['tox-notifications-container'] - }, - lazySink: extras.backstage.shared.getSink, - fireDismissalEventInstead: {} - }, backstage.shared.header.isPositionedAtTop() ? {} : { fireRepositionEventInstead: {} }))); - uiMothership.add(notificationWrapper); - if (settings.timeout > 0) { - global$2.setTimeout(function () { - close(); - }, settings.timeout); - } - return { - close: close, - moveTo: function (x, y) { - InlineView.showAt(notificationWrapper, { - anchor: 'makeshift', - x: x, - y: y - }, premade$1(notification)); - }, - moveRel: function (element, rel) { - if (rel !== 'banner') { - var layoutDirection_1 = getLayoutDirection(rel); - var nodeAnchor = { - anchor: 'node', - root: body(), - node: Optional.some(SugarElement.fromDom(element)), - layouts: { - onRtl: function () { - return [layoutDirection_1]; - }, - onLtr: function () { - return [layoutDirection_1]; - } - } - }; - InlineView.showAt(notificationWrapper, nodeAnchor, premade$1(notification)); - } else { - InlineView.showAt(notificationWrapper, extras.backstage.shared.anchors.banner(), premade$1(notification)); - } - }, - text: function (nuText) { - Notification.updateText(notification, nuText); - }, - settings: settings, - getEl: function () { - return notification.element.dom; - }, - progressBar: { - value: function (percent) { - Notification.updateProgress(notification, percent); - } - } - }; - }; - var close = function (notification) { - notification.close(); - }; - var getArgs = function (notification) { - return notification.settings; - }; - return { - open: open, - close: close, - reposition: reposition, - getArgs: getArgs - }; - } - - var first = function (fn, rate) { - var timer = null; - var cancel = function () { - if (timer !== null) { - clearTimeout(timer); - timer = null; - } - }; - var throttle = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (timer === null) { - timer = setTimeout(function () { - fn.apply(null, args); - timer = null; - }, rate); - } - }; - return { - cancel: cancel, - throttle: throttle - }; - }; - var last$2 = function (fn, rate) { - var timer = null; - var cancel = function () { - if (timer !== null) { - clearTimeout(timer); - timer = null; - } - }; - var throttle = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (timer !== null) { - clearTimeout(timer); - } - timer = setTimeout(function () { - fn.apply(null, args); - timer = null; - }, rate); - }; - return { - cancel: cancel, - throttle: throttle - }; - }; - - var global$3 = tinymce.util.Tools.resolve('tinymce.dom.TextSeeker'); - - var isBoundary = function (dom, node) { - return dom.isBlock(node) || contains([ - 'BR', - 'IMG', - 'HR', - 'INPUT' - ], node.nodeName) || dom.getContentEditable(node) === 'false'; - }; - var repeatLeft = function (dom, node, offset, process, rootNode) { - var search = global$3(dom, function (node) { - return isBoundary(dom, node); - }); - return Optional.from(search.backwards(node, offset, process, rootNode)); - }; - - var autocompleteSelector = '[data-mce-autocompleter]'; - var create$4 = function (editor, range) { - return detect$4(SugarElement.fromDom(editor.selection.getNode())).getOrThunk(function () { - var wrapper = SugarElement.fromHtml('', editor.getDoc()); - append(wrapper, SugarElement.fromDom(range.extractContents())); - range.insertNode(wrapper.dom); - parent(wrapper).each(function (elm) { - return elm.dom.normalize(); - }); - last$1(wrapper).map(function (last) { - editor.selection.setCursorLocation(last.dom, getEnd(last)); - }); - return wrapper; - }); - }; - var detect$4 = function (elm) { - return closest$3(elm, autocompleteSelector); - }; - - var isValidTextRange = function (rng) { - return rng.collapsed && rng.startContainer.nodeType === 3; - }; - var getText = function (rng) { - return rng.toString().replace(/\u00A0/g, ' ').replace(/\uFEFF/g, ''); - }; - var isWhitespace = function (chr) { - return chr !== '' && ' \xA0\f\n\r\t\x0B'.indexOf(chr) !== -1; - }; - - var stripTriggerChar = function (text, triggerCh) { - return text.substring(triggerCh.length); - }; - var findChar = function (text, index, ch) { - var i; - for (i = index - 1; i >= 0; i--) { - var char = text.charAt(i); - if (isWhitespace(char)) { - return Optional.none(); - } - if (char === ch) { - break; - } - } - return Optional.some(i); - }; - var findStart = function (dom, initRange, ch, minChars) { - if (minChars === void 0) { - minChars = 0; - } - if (!isValidTextRange(initRange)) { - return Optional.none(); - } - var findTriggerChIndex = function (element, offset, text) { - return findChar(text, offset, ch).getOr(offset); - }; - var root = dom.getParent(initRange.startContainer, dom.isBlock) || dom.getRoot(); - return repeatLeft(dom, initRange.startContainer, initRange.startOffset, findTriggerChIndex, root).bind(function (spot) { - var range = initRange.cloneRange(); - range.setStart(spot.container, spot.offset); - range.setEnd(initRange.endContainer, initRange.endOffset); - if (range.collapsed) { - return Optional.none(); - } - var text = getText(range); - var triggerCharIndex = text.lastIndexOf(ch); - if (triggerCharIndex !== 0 || stripTriggerChar(text, ch).length < minChars) { - return Optional.none(); - } else { - return Optional.some({ - text: stripTriggerChar(text, ch), - range: range, - triggerChar: ch - }); - } - }); - }; - var getContext = function (dom, initRange, ch, minChars) { - if (minChars === void 0) { - minChars = 0; - } - return detect$4(SugarElement.fromDom(initRange.startContainer)).fold(function () { - return findStart(dom, initRange, ch, minChars); - }, function (elm) { - var range = dom.createRng(); - range.selectNode(elm.dom); - var text = getText(range); - return Optional.some({ - range: range, - text: stripTriggerChar(text, ch), - triggerChar: ch - }); - }); - }; - - var setup = function (api, editor) { - editor.on('keypress compositionend', api.onKeypress.throttle); - editor.on('remove', api.onKeypress.cancel); - var redirectKeyToItem = function (item, e) { - emitWith(item, keydown(), { raw: e }); - }; - editor.on('keydown', function (e) { - var getItem = function () { - return api.getView().bind(Highlighting.getHighlighted); - }; - if (e.which === 8) { - api.onKeypress.throttle(e); - } - if (api.isActive()) { - if (e.which === 27) { - api.cancelIfNecessary(); - } - if (api.isMenuOpen()) { - if (e.which === 13) { - getItem().each(emitExecute); - e.preventDefault(); - } else if (e.which === 40) { - getItem().fold(function () { - api.getView().each(Highlighting.highlightFirst); - }, function (item) { - redirectKeyToItem(item, e); - }); - e.preventDefault(); - e.stopImmediatePropagation(); - } else if (e.which === 37 || e.which === 38 || e.which === 39) { - getItem().each(function (item) { - redirectKeyToItem(item, e); - e.preventDefault(); - e.stopImmediatePropagation(); - }); - } - } else { - if (e.which === 13 || e.which === 38 || e.which === 40) { - api.cancelIfNecessary(); - } - } - } - }); - editor.on('NodeChange', function (e) { - if (api.isActive() && !api.isProcessingAction() && detect$4(SugarElement.fromDom(e.element)).isNone()) { - api.cancelIfNecessary(); - } - }); - }; - var AutocompleterEditorEvents = { setup: setup }; - - var global$4 = tinymce.util.Tools.resolve('tinymce.util.Promise'); - - var point$1 = function (container, offset) { - return { - container: container, - offset: offset - }; - }; - - var isText$1 = function (node) { - return node.nodeType === TEXT; - }; - var isElement$1 = function (node) { - return node.nodeType === ELEMENT; - }; - var toLast = function (node) { - if (isText$1(node)) { - return point$1(node, node.data.length); - } else { - var children = node.childNodes; - return children.length > 0 ? toLast(children[children.length - 1]) : point$1(node, children.length); - } - }; - var toLeaf = function (node, offset) { - var children = node.childNodes; - if (children.length > 0 && offset < children.length) { - return toLeaf(children[offset], 0); - } else if (children.length > 0 && isElement$1(node) && children.length === offset) { - return toLast(children[children.length - 1]); - } else { - return point$1(node, offset); - } - }; - - var isPreviousCharContent = function (dom, leaf) { - return repeatLeft(dom, leaf.container, leaf.offset, function (element, offset) { - return offset === 0 ? -1 : offset; - }, dom.getRoot()).filter(function (spot) { - var char = spot.container.data.charAt(spot.offset - 1); - return !isWhitespace(char); - }).isSome(); - }; - var isStartOfWord = function (dom) { - return function (rng) { - var leaf = toLeaf(rng.startContainer, rng.startOffset); - return !isPreviousCharContent(dom, leaf); - }; - }; - var getTriggerContext = function (dom, initRange, database) { - return findMap(database.triggerChars, function (ch) { - return getContext(dom, initRange, ch); - }); - }; - var lookup = function (editor, getDatabase) { - var database = getDatabase(); - var rng = editor.selection.getRng(); - return getTriggerContext(editor.dom, rng, database).bind(function (context) { - return lookupWithContext(editor, getDatabase, context); - }); - }; - var lookupWithContext = function (editor, getDatabase, context, fetchOptions) { - if (fetchOptions === void 0) { - fetchOptions = {}; - } - var database = getDatabase(); - var rng = editor.selection.getRng(); - var startText = rng.startContainer.nodeValue; - var autocompleters = filter(database.lookupByChar(context.triggerChar), function (autocompleter) { - return context.text.length >= autocompleter.minChars && autocompleter.matches.getOrThunk(function () { - return isStartOfWord(editor.dom); - })(context.range, startText, context.text); - }); - if (autocompleters.length === 0) { - return Optional.none(); - } - var lookupData = global$4.all(map(autocompleters, function (ac) { - var fetchResult = ac.fetch(context.text, ac.maxResults, fetchOptions); - return fetchResult.then(function (results) { - return { - matchText: context.text, - items: results, - columns: ac.columns, - onAction: ac.onAction, - highlightOn: ac.highlightOn - }; - }); - })); - return Optional.some({ - lookupData: lookupData, - context: context - }); - }; - - var separatorMenuItemSchema = objOf([ - strictString('type'), - optionString('text') - ]); - var createSeparatorMenuItem = function (spec) { - return asRaw('separatormenuitem', separatorMenuItemSchema, spec); - }; - - var autocompleterItemSchema = objOf([ - defaulted$1('type', 'autocompleteitem'), - defaulted$1('active', false), - defaulted$1('disabled', false), - defaulted$1('meta', {}), - strictString('value'), - optionString('text'), - optionString('icon') - ]); - var autocompleterSchema = objOf([ - strictString('type'), - strictString('ch'), - defaultedNumber('minChars', 1), - defaulted$1('columns', 1), - defaultedNumber('maxResults', 10), - optionFunction('matches'), - strictFunction('fetch'), - strictFunction('onAction'), - defaultedArrayOf('highlightOn', [], string) - ]); - var createSeparatorItem = function (spec) { - return asRaw('Autocompleter.Separator', separatorMenuItemSchema, spec); - }; - var createAutocompleterItem = function (spec) { - return asRaw('Autocompleter.Item', autocompleterItemSchema, spec); - }; - var createAutocompleter = function (spec) { - return asRaw('Autocompleter', autocompleterSchema, spec); - }; - - var baseToolbarButtonFields = [ - defaultedBoolean('disabled', false), - optionString('tooltip'), - optionString('icon'), - optionString('text'), - defaultedFunction('onSetup', function () { - return noop; - }) - ]; - var toolbarButtonSchema = objOf([ - strictString('type'), - strictFunction('onAction') - ].concat(baseToolbarButtonFields)); - var createToolbarButton = function (spec) { - return asRaw('toolbarbutton', toolbarButtonSchema, spec); - }; - - var baseToolbarToggleButtonFields = [defaultedBoolean('active', false)].concat(baseToolbarButtonFields); - var toggleButtonSchema = objOf(baseToolbarToggleButtonFields.concat([ - strictString('type'), - strictFunction('onAction') - ])); - var createToggleButton = function (spec) { - return asRaw('ToggleButton', toggleButtonSchema, spec); - }; - - var contextBarFields = [ - defaultedFunction('predicate', never), - defaultedStringEnum('scope', 'node', [ - 'node', - 'editor' - ]), - defaultedStringEnum('position', 'selection', [ - 'node', - 'selection', - 'line' - ]) - ]; - - var contextButtonFields = baseToolbarButtonFields.concat([ - defaulted$1('type', 'contextformbutton'), - defaulted$1('primary', false), - strictFunction('onAction'), - state$1('original', identity) - ]); - var contextToggleButtonFields = baseToolbarToggleButtonFields.concat([ - defaulted$1('type', 'contextformbutton'), - defaulted$1('primary', false), - strictFunction('onAction'), - state$1('original', identity) - ]); - var launchButtonFields = baseToolbarButtonFields.concat([defaulted$1('type', 'contextformbutton')]); - var launchToggleButtonFields = baseToolbarToggleButtonFields.concat([defaulted$1('type', 'contextformtogglebutton')]); - var toggleOrNormal = choose$1('type', { - contextformbutton: contextButtonFields, - contextformtogglebutton: contextToggleButtonFields - }); - var contextFormSchema = objOf([ - defaulted$1('type', 'contextform'), - defaultedFunction('initValue', function () { - return ''; - }), - optionString('label'), - strictArrayOf('commands', toggleOrNormal), - optionOf('launch', choose$1('type', { - contextformbutton: launchButtonFields, - contextformtogglebutton: launchToggleButtonFields - })) - ].concat(contextBarFields)); - var createContextForm = function (spec) { - return asRaw('ContextForm', contextFormSchema, spec); - }; - - var contextToolbarSchema = objOf([ - defaulted$1('type', 'contexttoolbar'), - strictString('items') - ].concat(contextBarFields)); - var createContextToolbar = function (spec) { - return asRaw('ContextToolbar', contextToolbarSchema, spec); - }; - - var stringArray = function (a) { - var all = {}; - each(a, function (key) { - all[key] = {}; - }); - return keys(all); - }; - - var register = function (editor) { - var popups = editor.ui.registry.getAll().popups; - var dataset = map$2(popups, function (popup) { - return createAutocompleter(popup).fold(function (err) { - throw new Error(formatError(err)); - }, function (x) { - return x; - }); - }); - var triggerChars = stringArray(mapToArray(dataset, function (v) { - return v.ch; - })); - var datasetValues = values(dataset); - var lookupByChar = function (ch) { - return filter(datasetValues, function (dv) { - return dv.ch === ch; - }); - }; - return { - dataset: dataset, - triggerChars: triggerChars, - lookupByChar: lookupByChar - }; - }; - - var ItemResponse; - (function (ItemResponse) { - ItemResponse[ItemResponse['CLOSE_ON_EXECUTE'] = 0] = 'CLOSE_ON_EXECUTE'; - ItemResponse[ItemResponse['BUBBLE_TO_SANDBOX'] = 1] = 'BUBBLE_TO_SANDBOX'; - }(ItemResponse || (ItemResponse = {}))); - var ItemResponse$1 = ItemResponse; - - var navClass = 'tox-menu-nav__js'; - var selectableClass = 'tox-collection__item'; - var colorClass = 'tox-swatch'; - var presetClasses = { - normal: navClass, - color: colorClass - }; - var tickedClass = 'tox-collection__item--enabled'; - var groupHeadingClass = 'tox-collection__group-heading'; - var iconClass = 'tox-collection__item-icon'; - var textClass = 'tox-collection__item-label'; - var accessoryClass = 'tox-collection__item-accessory'; - var caretClass = 'tox-collection__item-caret'; - var checkmarkClass = 'tox-collection__item-checkmark'; - var activeClass = 'tox-collection__item--active'; - var iconClassRtl = 'tox-collection__item-icon-rtl'; - var containerClass = 'tox-collection__item-container'; - var containerColumnClass = 'tox-collection__item-container--column'; - var containerRowClass = 'tox-collection__item-container--row'; - var containerAlignRightClass = 'tox-collection__item-container--align-right'; - var containerAlignLeftClass = 'tox-collection__item-container--align-left'; - var containerValignTopClass = 'tox-collection__item-container--valign-top'; - var containerValignMiddleClass = 'tox-collection__item-container--valign-middle'; - var containerValignBottomClass = 'tox-collection__item-container--valign-bottom'; - var classForPreset = function (presets) { - return get$1(presetClasses, presets).getOr(navClass); - }; - - var forMenu = function (presets) { - if (presets === 'color') { - return 'tox-swatches'; - } else { - return 'tox-menu'; - } - }; - var classes = function (presets) { - return { - backgroundMenu: 'tox-background-menu', - selectedMenu: 'tox-selected-menu', - selectedItem: 'tox-collection__item--active', - hasIcons: 'tox-menu--has-icons', - menu: forMenu(presets), - tieredMenu: 'tox-tiered-menu' - }; - }; - - var markers$1 = function (presets) { - var menuClasses = classes(presets); - return { - backgroundMenu: menuClasses.backgroundMenu, - selectedMenu: menuClasses.selectedMenu, - menu: menuClasses.menu, - selectedItem: menuClasses.selectedItem, - item: classForPreset(presets) - }; - }; - var dom$1 = function (hasIcons, columns, presets) { - var menuClasses = classes(presets); - return { - tag: 'div', - classes: flatten([ - [ - menuClasses.menu, - 'tox-menu-' + columns + '-column' - ], - hasIcons ? [menuClasses.hasIcons] : [] - ]) - }; - }; - var components$1 = [Menu.parts.items({})]; - var part = function (hasIcons, columns, presets) { - var menuClasses = classes(presets); - var d = { - tag: 'div', - classes: flatten([[menuClasses.tieredMenu]]) - }; - return { - dom: d, - markers: markers$1(presets) - }; - }; - - var chunk$1 = function (rowDom, numColumns) { - return function (items) { - var chunks = chunk(items, numColumns); - return map(chunks, function (c) { - return { - dom: rowDom, - components: c - }; - }); - }; - }; - var forSwatch = function (columns) { - return { - dom: { - tag: 'div', - classes: [ - 'tox-menu', - 'tox-swatches-menu' - ] - }, - components: [{ - dom: { - tag: 'div', - classes: ['tox-swatches'] - }, - components: [Menu.parts.items({ - preprocess: columns !== 'auto' ? chunk$1({ - tag: 'div', - classes: ['tox-swatches__row'] - }, columns) : identity - })] - }] - }; - }; - var forToolbar = function (columns) { - return { - dom: { - tag: 'div', - classes: [ - 'tox-menu', - 'tox-collection', - 'tox-collection--toolbar', - 'tox-collection--toolbar-lg' - ] - }, - components: [Menu.parts.items({ - preprocess: chunk$1({ - tag: 'div', - classes: ['tox-collection__group'] - }, columns) - })] - }; - }; - var preprocessCollection = function (items, isSeparator) { - var allSplits = []; - var currentSplit = []; - each(items, function (item, i) { - if (isSeparator(item, i)) { - if (currentSplit.length > 0) { - allSplits.push(currentSplit); - } - currentSplit = []; - if (has(item.dom, 'innerHtml')) { - currentSplit.push(item); - } - } else { - currentSplit.push(item); - } - }); - if (currentSplit.length > 0) { - allSplits.push(currentSplit); - } - return map(allSplits, function (s) { - return { - dom: { - tag: 'div', - classes: ['tox-collection__group'] - }, - components: s - }; - }); - }; - var forCollection = function (columns, initItems, _hasIcons) { - return { - dom: { - tag: 'div', - classes: [ - 'tox-menu', - 'tox-collection' - ].concat(columns === 1 ? ['tox-collection--list'] : ['tox-collection--grid']) - }, - components: [Menu.parts.items({ - preprocess: function (items) { - if (columns !== 'auto' && columns > 1) { - return chunk$1({ - tag: 'div', - classes: ['tox-collection__group'] - }, columns)(items); - } else { - return preprocessCollection(items, function (_item, i) { - return initItems[i].type === 'separator'; - }); - } - } - })] - }; - }; - var forHorizontalCollection = function (initItems, _hasIcons) { - return { - dom: { - tag: 'div', - classes: [ - 'tox-collection', - 'tox-collection--horizontal' - ] - }, - components: [Menu.parts.items({ - preprocess: function (items) { - return preprocessCollection(items, function (_item, i) { - return initItems[i].type === 'separator'; - }); - } - })] - }; - }; - - var menuHasIcons = function (xs) { - return exists(xs, function (item) { - return 'icon' in item && item.icon !== undefined; - }); - }; - var handleError = function (error) { - console.error(formatError(error)); - console.log(error); - return Optional.none(); - }; - var createHorizontalPartialMenuWithAlloyItems = function (value, _hasIcons, items, _columns, _presets) { - var structure = forHorizontalCollection(items); - return { - value: value, - dom: structure.dom, - components: structure.components, - items: items - }; - }; - var createPartialMenuWithAlloyItems = function (value, hasIcons, items, columns, presets) { - if (presets === 'color') { - var structure = forSwatch(columns); - return { - value: value, - dom: structure.dom, - components: structure.components, - items: items - }; - } - if (presets === 'normal' && columns === 'auto') { - var structure = forCollection(columns, items); - return { - value: value, - dom: structure.dom, - components: structure.components, - items: items - }; - } - if (presets === 'normal' && columns === 1) { - var structure = forCollection(1, items); - return { - value: value, - dom: structure.dom, - components: structure.components, - items: items - }; - } - if (presets === 'normal') { - var structure = forCollection(columns, items); - return { - value: value, - dom: structure.dom, - components: structure.components, - items: items - }; - } - if (presets === 'listpreview' && columns !== 'auto') { - var structure = forToolbar(columns); - return { - value: value, - dom: structure.dom, - components: structure.components, - items: items - }; - } - return { - value: value, - dom: dom$1(hasIcons, columns, presets), - components: components$1, - items: items - }; - }; - - var cardImageFields = [ - strictString('type'), - strictString('src'), - optionString('alt'), - defaultedArrayOf('classes', [], string) - ]; - var cardImageSchema = objOf(cardImageFields); - - var cardTextFields = [ - strictString('type'), - strictString('text'), - optionString('name'), - defaultedArrayOf('classes', ['tox-collection__item-label'], string) - ]; - var cardTextSchema = objOf(cardTextFields); - - var itemSchema$2 = valueThunkOf(function () { - return chooseProcessor('type', { - cardimage: cardImageSchema, - cardtext: cardTextSchema, - cardcontainer: cardContainerSchema - }); - }); - var cardContainerSchema = objOf([ - strictString('type'), - defaultedString('direction', 'horizontal'), - defaultedString('align', 'left'), - defaultedString('valign', 'middle'), - strictArrayOf('items', itemSchema$2) - ]); - - var commonMenuItemFields = [ - defaultedBoolean('disabled', false), - optionString('text'), - optionString('shortcut'), - field('value', 'value', defaultedThunk(function () { - return generate$1('menuitem-value'); - }), anyValue$1()), - defaulted$1('meta', {}) - ]; - - var cardMenuItemSchema = objOf([ - strictString('type'), - optionString('label'), - strictArrayOf('items', itemSchema$2), - defaultedFunction('onSetup', function () { - return noop; - }), - defaultedFunction('onAction', noop) - ].concat(commonMenuItemFields)); - var createCardMenuItem = function (spec) { - return asRaw('cardmenuitem', cardMenuItemSchema, spec); - }; - - var choiceMenuItemSchema = objOf([ - strictString('type'), - defaultedBoolean('active', false), - optionString('icon') - ].concat(commonMenuItemFields)); - var createChoiceMenuItem = function (spec) { - return asRaw('choicemenuitem', choiceMenuItemSchema, spec); - }; - - var fancyTypes = [ - 'inserttable', - 'colorswatch' - ]; - var fancyMenuItemSchema = objOf([ - strictString('type'), - strictStringEnum('fancytype', fancyTypes), - defaultedFunction('onAction', noop) - ]); - var createFancyMenuItem = function (spec) { - return asRaw('fancymenuitem', fancyMenuItemSchema, spec); - }; - - var menuItemSchema = objOf([ - strictString('type'), - defaultedFunction('onSetup', function () { - return noop; - }), - defaultedFunction('onAction', noop), - optionString('icon') - ].concat(commonMenuItemFields)); - var createMenuItem = function (spec) { - return asRaw('menuitem', menuItemSchema, spec); - }; - - var nestedMenuItemSchema = objOf([ - strictString('type'), - strictFunction('getSubmenuItems'), - defaultedFunction('onSetup', function () { - return noop; - }), - optionString('icon') - ].concat(commonMenuItemFields)); - var createNestedMenuItem = function (spec) { - return asRaw('nestedmenuitem', nestedMenuItemSchema, spec); - }; - - var toggleMenuItemSchema = objOf([ - strictString('type'), - optionString('icon'), - defaultedBoolean('active', false), - defaultedFunction('onSetup', function () { - return noop; - }), - strictFunction('onAction') - ].concat(commonMenuItemFields)); - var createToggleMenuItem = function (spec) { - return asRaw('togglemenuitem', toggleMenuItemSchema, spec); - }; - - var detectSize = function (comp, margin, selectorClass) { - var descendants$1 = descendants(comp.element, '.' + selectorClass); - if (descendants$1.length > 0) { - var columnLength = findIndex(descendants$1, function (c) { - var thisTop = c.dom.getBoundingClientRect().top; - var cTop = descendants$1[0].dom.getBoundingClientRect().top; - return Math.abs(thisTop - cTop) > margin; - }).getOr(descendants$1.length); - return Optional.some({ - numColumns: columnLength, - numRows: Math.ceil(descendants$1.length / columnLength) - }); - } else { - return Optional.none(); - } - }; - - var namedEvents = function (name, handlers) { - return derive$1([config(name, handlers)]); - }; - var unnamedEvents = function (handlers) { - return namedEvents(generate$1('unnamed-events'), handlers); - }; - var SimpleBehaviours = { - namedEvents: namedEvents, - unnamedEvents: unnamedEvents - }; - - var ExclusivityChannel = generate$1('tooltip.exclusive'); - var ShowTooltipEvent = generate$1('tooltip.show'); - var HideTooltipEvent = generate$1('tooltip.hide'); - - var hideAllExclusive = function (component, _tConfig, _tState) { - component.getSystem().broadcastOn([ExclusivityChannel], {}); - }; - var setComponents = function (component, tConfig, tState, specs) { - tState.getTooltip().each(function (tooltip) { - if (tooltip.getSystem().isConnected()) { - Replacing.set(tooltip, specs); - } - }); - }; - - var TooltippingApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - hideAllExclusive: hideAllExclusive, - setComponents: setComponents - }); - - var events$8 = function (tooltipConfig, state) { - var hide = function (comp) { - state.getTooltip().each(function (p) { - detach(p); - tooltipConfig.onHide(comp, p); - state.clearTooltip(); - }); - state.clearTimer(); - }; - var show = function (comp) { - if (!state.isShowing()) { - hideAllExclusive(comp); - var sink = tooltipConfig.lazySink(comp).getOrDie(); - var popup = comp.getSystem().build({ - dom: tooltipConfig.tooltipDom, - components: tooltipConfig.tooltipComponents, - events: derive(tooltipConfig.mode === 'normal' ? [ - run(mouseover(), function (_) { - emit(comp, ShowTooltipEvent); - }), - run(mouseout(), function (_) { - emit(comp, HideTooltipEvent); - }) - ] : []), - behaviours: derive$1([Replacing.config({})]) - }); - state.setTooltip(popup); - attach$1(sink, popup); - tooltipConfig.onShow(comp, popup); - Positioning.position(sink, tooltipConfig.anchor(comp), popup); - } - }; - return derive(flatten([ - [ - run(ShowTooltipEvent, function (comp) { - state.resetTimer(function () { - show(comp); - }, tooltipConfig.delay); - }), - run(HideTooltipEvent, function (comp) { - state.resetTimer(function () { - hide(comp); - }, tooltipConfig.delay); - }), - run(receive(), function (comp, message) { - var receivingData = message; - if (!receivingData.universal) { - if (contains(receivingData.channels, ExclusivityChannel)) { - hide(comp); - } - } - }), - runOnDetached(function (comp) { - hide(comp); - }) - ], - tooltipConfig.mode === 'normal' ? [ - run(focusin(), function (comp) { - emit(comp, ShowTooltipEvent); - }), - run(postBlur(), function (comp) { - emit(comp, HideTooltipEvent); - }), - run(mouseover(), function (comp) { - emit(comp, ShowTooltipEvent); - }), - run(mouseout(), function (comp) { - emit(comp, HideTooltipEvent); - }) - ] : [ - run(highlight(), function (comp, _se) { - emit(comp, ShowTooltipEvent); - }), - run(dehighlight(), function (comp) { - emit(comp, HideTooltipEvent); - }) - ] - ])); - }; - - var ActiveTooltipping = /*#__PURE__*/Object.freeze({ - __proto__: null, - events: events$8 - }); - - var TooltippingSchema = [ - strict$1('lazySink'), - strict$1('tooltipDom'), - defaulted$1('exclusive', true), - defaulted$1('tooltipComponents', []), - defaulted$1('delay', 300), - defaultedStringEnum('mode', 'normal', [ - 'normal', - 'follow-highlight' - ]), - defaulted$1('anchor', function (comp) { - return { - anchor: 'hotspot', - hotspot: comp, - layouts: { - onLtr: constant([ - south$1, - north$1, - southeast$1, - northeast$1, - southwest$1, - northwest$1 - ]), - onRtl: constant([ - south$1, - north$1, - southeast$1, - northeast$1, - southwest$1, - northwest$1 - ]) - } - }; - }), - onHandler('onHide'), - onHandler('onShow') - ]; - - var init$4 = function () { - var timer = Cell(Optional.none()); - var popup = Cell(Optional.none()); - var getTooltip = function () { - return popup.get(); - }; - var setTooltip = function (comp) { - popup.set(Optional.some(comp)); - }; - var clearTooltip = function () { - popup.set(Optional.none()); - }; - var clearTimer = function () { - timer.get().each(function (t) { - clearTimeout(t); - }); - }; - var resetTimer = function (f, delay) { - clearTimer(); - timer.set(Optional.some(setTimeout(function () { - f(); - }, delay))); - }; - var isShowing = function () { - return popup.get().isSome(); - }; - var readState = constant('not-implemented'); - return nu$5({ - getTooltip: getTooltip, - isShowing: isShowing, - setTooltip: setTooltip, - clearTooltip: clearTooltip, - clearTimer: clearTimer, - resetTimer: resetTimer, - readState: readState - }); - }; - - var TooltippingState = /*#__PURE__*/Object.freeze({ - __proto__: null, - init: init$4 - }); - - var Tooltipping = create$1({ - fields: TooltippingSchema, - name: 'tooltipping', - active: ActiveTooltipping, - state: TooltippingState, - apis: TooltippingApis - }); - - var escape = function (text) { - return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - }; - - var global$5 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils'); - - var global$6 = tinymce.util.Tools.resolve('tinymce.util.I18n'); - - var nativeDisabled = [ - 'input', - 'button', - 'textarea', - 'select' - ]; - var onLoad$5 = function (component, disableConfig, disableState) { - var f = disableConfig.disabled() ? disable : enable; - f(component, disableConfig); - }; - var hasNative = function (component, config) { - return config.useNative === true && contains(nativeDisabled, name(component.element)); - }; - var nativeIsDisabled = function (component) { - return has$1(component.element, 'disabled'); - }; - var nativeDisable = function (component) { - set$1(component.element, 'disabled', 'disabled'); - }; - var nativeEnable = function (component) { - remove$1(component.element, 'disabled'); - }; - var ariaIsDisabled = function (component) { - return get$3(component.element, 'aria-disabled') === 'true'; - }; - var ariaDisable = function (component) { - set$1(component.element, 'aria-disabled', 'true'); - }; - var ariaEnable = function (component) { - set$1(component.element, 'aria-disabled', 'false'); - }; - var disable = function (component, disableConfig, _disableState) { - disableConfig.disableClass.each(function (disableClass) { - add$2(component.element, disableClass); - }); - var f = hasNative(component, disableConfig) ? nativeDisable : ariaDisable; - f(component); - disableConfig.onDisabled(component); - }; - var enable = function (component, disableConfig, _disableState) { - disableConfig.disableClass.each(function (disableClass) { - remove$4(component.element, disableClass); - }); - var f = hasNative(component, disableConfig) ? nativeEnable : ariaEnable; - f(component); - disableConfig.onEnabled(component); - }; - var isDisabled = function (component, disableConfig) { - return hasNative(component, disableConfig) ? nativeIsDisabled(component) : ariaIsDisabled(component); - }; - var set$7 = function (component, disableConfig, disableState, disabled) { - var f = disabled ? disable : enable; - f(component, disableConfig); - }; - - var DisableApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - enable: enable, - disable: disable, - isDisabled: isDisabled, - onLoad: onLoad$5, - set: set$7 - }); - - var exhibit$3 = function (base, disableConfig) { - return nu$6({ classes: disableConfig.disabled() ? disableConfig.disableClass.toArray() : [] }); - }; - var events$9 = function (disableConfig, disableState) { - return derive([ - abort(execute(), function (component, _simulatedEvent) { - return isDisabled(component, disableConfig); - }), - loadEvent(disableConfig, disableState, onLoad$5) - ]); - }; - - var ActiveDisable = /*#__PURE__*/Object.freeze({ - __proto__: null, - exhibit: exhibit$3, - events: events$9 - }); - - var DisableSchema = [ - defaultedFunction('disabled', never), - defaulted$1('useNative', true), - option('disableClass'), - onHandler('onDisabled'), - onHandler('onEnabled') - ]; - - var Disabling = create$1({ - fields: DisableSchema, - name: 'disabling', - active: ActiveDisable, - apis: DisableApis - }); - - var global$7 = tinymce.util.Tools.resolve('tinymce.EditorManager'); - - var getSkinUrl = function (editor) { - var skin = editor.getParam('skin'); - var skinUrl = editor.getParam('skin_url'); - if (skin !== false) { - var skinName = skin ? skin : 'oxide'; - if (skinUrl) { - skinUrl = editor.documentBaseURI.toAbsolute(skinUrl); - } else { - skinUrl = global$7.baseURL + '/skins/ui/' + skinName; - } - } - return skinUrl; - }; - var isReadOnly = function (editor) { - return editor.getParam('readonly', false, 'boolean'); - }; - var isSkinDisabled = function (editor) { - return editor.getParam('skin') === false; - }; - var getHeightSetting = function (editor) { - return editor.getParam('height', Math.max(editor.getElement().offsetHeight, 200)); - }; - var getWidthSetting = function (editor) { - return editor.getParam('width', global$5.DOM.getStyle(editor.getElement(), 'width')); - }; - var getMinWidthSetting = function (editor) { - return Optional.from(editor.getParam('min_width')).filter(isNumber); - }; - var getMinHeightSetting = function (editor) { - return Optional.from(editor.getParam('min_height')).filter(isNumber); - }; - var getMaxWidthSetting = function (editor) { - return Optional.from(editor.getParam('max_width')).filter(isNumber); - }; - var getMaxHeightSetting = function (editor) { - return Optional.from(editor.getParam('max_height')).filter(isNumber); - }; - var getUserStyleFormats = function (editor) { - return Optional.from(editor.getParam('style_formats')).filter(isArray); - }; - var isMergeStyleFormats = function (editor) { - return editor.getParam('style_formats_merge', false, 'boolean'); - }; - var getLineHeightFormats = function (editor) { - return editor.getParam('lineheight_formats', '1 1.1 1.2 1.3 1.4 1.5 2', 'string').split(' '); - }; - var getRemovedMenuItems = function (editor) { - return editor.getParam('removed_menuitems', ''); - }; - var isMenubarEnabled = function (editor) { - return editor.getParam('menubar', true, 'boolean') !== false; - }; - var isToolbarEnabled = function (editor) { - var toolbar = editor.getParam('toolbar', true); - var isToolbarTrue = toolbar === true; - var isToolbarString = isString(toolbar); - var isToolbarObjectArray = isArray(toolbar) && toolbar.length > 0; - return !isMultipleToolbars(editor) && (isToolbarObjectArray || isToolbarString || isToolbarTrue); - }; - var getMultipleToolbarsSetting = function (editor) { - var toolbars = range(9, function (num) { - return editor.getParam('toolbar' + (num + 1), false, 'string'); - }); - var toolbarArray = filter(toolbars, function (toolbar) { - return typeof toolbar === 'string'; - }); - return toolbarArray.length > 0 ? Optional.some(toolbarArray) : Optional.none(); - }; - var isMultipleToolbars = function (editor) { - return getMultipleToolbarsSetting(editor).fold(function () { - var toolbar = editor.getParam('toolbar', [], 'string[]'); - return toolbar.length > 0; - }, always); - }; - var ToolbarMode; - (function (ToolbarMode) { - ToolbarMode['default'] = 'wrap'; - ToolbarMode['floating'] = 'floating'; - ToolbarMode['sliding'] = 'sliding'; - ToolbarMode['scrolling'] = 'scrolling'; - }(ToolbarMode || (ToolbarMode = {}))); - var getToolbarMode = function (editor) { - return editor.getParam('toolbar_mode', '', 'string'); - }; - var ToolbarLocation; - (function (ToolbarLocation) { - ToolbarLocation['auto'] = 'auto'; - ToolbarLocation['top'] = 'top'; - ToolbarLocation['bottom'] = 'bottom'; - }(ToolbarLocation || (ToolbarLocation = {}))); - var getToolbarGroups = function (editor) { - return editor.getParam('toolbar_groups', {}, 'object'); - }; - var getToolbarLocation = function (editor) { - return editor.getParam('toolbar_location', ToolbarLocation.auto, 'string'); - }; - var isToolbarLocationBottom = function (editor) { - return getToolbarLocation(editor) === ToolbarLocation.bottom; - }; - var fixedContainerSelector = function (editor) { - return editor.getParam('fixed_toolbar_container', '', 'string'); - }; - var fixedToolbarContainerTarget = function (editor) { - return editor.getParam('fixed_toolbar_container_target'); - }; - var isToolbarPersist = function (editor) { - return editor.getParam('toolbar_persist', false, 'boolean'); - }; - var fixedContainerTarget = function (editor) { - if (!editor.inline) { - return Optional.none(); - } - var selector = fixedContainerSelector(editor); - if (selector.length > 0) { - return descendant$1(body(), selector); - } - var element = fixedToolbarContainerTarget(editor); - if (isNonNullable(element)) { - return Optional.some(SugarElement.fromDom(element)); - } - return Optional.none(); - }; - var useFixedContainer = function (editor) { - return editor.inline && fixedContainerTarget(editor).isSome(); - }; - var getUiContainer = function (editor) { - var fixedContainer = fixedContainerTarget(editor); - return fixedContainer.getOrThunk(function () { - return getContentContainer(getRootNode(SugarElement.fromDom(editor.getElement()))); - }); - }; - var isDistractionFree = function (editor) { - return editor.inline && !isMenubarEnabled(editor) && !isToolbarEnabled(editor) && !isMultipleToolbars(editor); - }; - var isStickyToolbar = function (editor) { - var isStickyToolbar = editor.getParam('toolbar_sticky', false, 'boolean'); - return (isStickyToolbar || editor.inline) && !useFixedContainer(editor) && !isDistractionFree(editor); - }; - var isDraggableModal = function (editor) { - return editor.getParam('draggable_modal', false, 'boolean'); - }; - var getMenus = function (editor) { - var menu = editor.getParam('menu'); - if (menu) { - return map$2(menu, function (menu) { - return __assign(__assign({}, menu), { items: menu.items }); - }); - } else { - return {}; - } - }; - var getMenubar = function (editor) { - return editor.getParam('menubar'); - }; - var getToolbar = function (editor) { - return editor.getParam('toolbar', true); - }; - var getFilePickerCallback = function (editor) { - return editor.getParam('file_picker_callback'); - }; - var getFilePickerTypes = function (editor) { - return editor.getParam('file_picker_types'); - }; - var getFileBrowserCallbackTypes = function (editor) { - return editor.getParam('file_browser_callback_types'); - }; - var noTypeaheadUrls = function (editor) { - return editor.getParam('typeahead_urls') === false; - }; - var getAnchorTop = function (editor) { - return editor.getParam('anchor_top', '#top'); - }; - var getAnchorBottom = function (editor) { - return editor.getParam('anchor_bottom', '#bottom'); - }; - var getFilePickerValidatorHandler = function (editor) { - var handler = editor.getParam('file_picker_validator_handler', undefined, 'function'); - if (handler === undefined) { - return editor.getParam('filepicker_validator_handler', undefined, 'function'); - } else { - return handler; - } - }; - - var ReadOnlyChannel = 'silver.readonly'; - var ReadOnlyDataSchema = objOf([strictBoolean('readonly')]); - var broadcastReadonly = function (uiComponents, readonly) { - var outerContainer = uiComponents.outerContainer; - var target = outerContainer.element; - if (readonly) { - uiComponents.mothership.broadcastOn([dismissPopups()], { target: target }); - uiComponents.uiMothership.broadcastOn([dismissPopups()], { target: target }); - } - uiComponents.mothership.broadcastOn([ReadOnlyChannel], { readonly: readonly }); - uiComponents.uiMothership.broadcastOn([ReadOnlyChannel], { readonly: readonly }); - }; - var setupReadonlyModeSwitch = function (editor, uiComponents) { - editor.on('init', function () { - if (editor.mode.isReadOnly()) { - broadcastReadonly(uiComponents, true); - } - }); - editor.on('SwitchMode', function () { - return broadcastReadonly(uiComponents, editor.mode.isReadOnly()); - }); - if (isReadOnly(editor)) { - editor.setMode('readonly'); - } - }; - var receivingConfig = function () { - var _a; - return Receiving.config({ - channels: (_a = {}, _a[ReadOnlyChannel] = { - schema: ReadOnlyDataSchema, - onReceive: function (comp, data) { - Disabling.set(comp, data.readonly); - } - }, _a) - }); - }; - - var item = function (disabled) { - return Disabling.config({ - disabled: disabled, - disableClass: 'tox-collection__item--state-disabled' - }); - }; - var button = function (disabled) { - return Disabling.config({ disabled: disabled }); - }; - var splitButton = function (disabled) { - return Disabling.config({ - disabled: disabled, - disableClass: 'tox-tbtn--disabled' - }); - }; - var toolbarButton = function (disabled) { - return Disabling.config({ - disabled: disabled, - disableClass: 'tox-tbtn--disabled', - useNative: false - }); - }; - var DisablingConfigs = { - item: item, - button: button, - splitButton: splitButton, - toolbarButton: toolbarButton - }; - - var runWithApi = function (info, comp) { - var api = info.getApi(comp); - return function (f) { - f(api); - }; - }; - var onControlAttached = function (info, editorOffCell) { - return runOnAttached(function (comp) { - var run = runWithApi(info, comp); - run(function (api) { - var onDestroy = info.onSetup(api); - if (isFunction(onDestroy)) { - editorOffCell.set(onDestroy); - } - }); - }); - }; - var onControlDetached = function (getApi, editorOffCell) { - return runOnDetached(function (comp) { - return runWithApi(getApi, comp)(editorOffCell.get()); - }); - }; - - var _a; - var onMenuItemExecute = function (info, itemResponse) { - return runOnExecute(function (comp, simulatedEvent) { - runWithApi(info, comp)(info.onAction); - if (!info.triggersSubmenu && itemResponse === ItemResponse$1.CLOSE_ON_EXECUTE) { - if (comp.getSystem().isConnected()) { - emit(comp, sandboxClose()); - } - simulatedEvent.stop(); - } - }); - }; - var menuItemEventOrder = (_a = {}, _a[execute()] = [ - 'disabling', - 'alloy.base.behaviour', - 'toggling', - 'item-events' - ], _a); - - var componentRenderPipeline = function (xs) { - return bind(xs, function (o) { - return o.toArray(); - }); - }; - var renderCommonItem = function (spec, structure, itemResponse, providersbackstage) { - var editorOffCell = Cell(noop); - return { - type: 'item', - dom: structure.dom, - components: componentRenderPipeline(structure.optComponents), - data: spec.data, - eventOrder: menuItemEventOrder, - hasSubmenu: spec.triggersSubmenu, - itemBehaviours: derive$1([ - config('item-events', [ - onMenuItemExecute(spec, itemResponse), - onControlAttached(spec, editorOffCell), - onControlDetached(spec, editorOffCell) - ]), - DisablingConfigs.item(function () { - return spec.disabled || providersbackstage.isDisabled(); - }), - receivingConfig(), - Replacing.config({}) - ].concat(spec.itemBehaviours)) - }; - }; - var buildData = function (source) { - return { - value: source.value, - meta: __assign({ text: source.text.getOr('') }, source.meta) - }; - }; - - var global$8 = tinymce.util.Tools.resolve('tinymce.Env'); - - var convertText = function (source) { - var mac = { - alt: '⌥', - ctrl: '⌃', - shift: '⇧', - meta: '⌘', - access: '⌃⌥' - }; - var other = { - meta: 'Ctrl', - access: 'Shift+Alt' - }; - var replace = global$8.mac ? mac : other; - var shortcut = source.split('+'); - var updated = map(shortcut, function (segment) { - var search = segment.toLowerCase().trim(); - return has(replace, search) ? replace[search] : segment; - }); - return global$8.mac ? updated.join('') : updated.join('+'); - }; - - var renderIcon = function (iconHtml) { - return { - dom: { - tag: 'div', - classes: [iconClass], - innerHtml: iconHtml - } - }; - }; - var renderText = function (text$1) { - return { - dom: { - tag: 'div', - classes: [textClass] - }, - components: [text(global$6.translate(text$1))] - }; - }; - var renderHtml = function (html, classes) { - return { - dom: { - tag: 'div', - classes: classes, - innerHtml: html - } - }; - }; - var renderStyledText = function (style, text$1) { - return { - dom: { - tag: 'div', - classes: [textClass] - }, - components: [{ - dom: { - tag: style.tag, - styles: style.styles - }, - components: [text(global$6.translate(text$1))] - }] - }; - }; - var renderShortcut = function (shortcut) { - return { - dom: { - tag: 'div', - classes: [accessoryClass], - innerHtml: convertText(shortcut) - } - }; - }; - var renderCheckmark = function (icons) { - return { - dom: { - tag: 'div', - classes: [checkmarkClass], - innerHtml: get$e('checkmark', icons) - } - }; - }; - var renderSubmenuCaret = function (icons) { - return { - dom: { - tag: 'div', - classes: [caretClass], - innerHtml: get$e('chevron-right', icons) - } - }; - }; - var renderDownwardsCaret = function (icons) { - return { - dom: { - tag: 'div', - classes: [caretClass], - innerHtml: get$e('chevron-down', icons) - } - }; - }; - var renderContainer = function (container, components) { - var directionClass = container.direction === 'vertical' ? containerColumnClass : containerRowClass; - var alignClass = container.align === 'left' ? containerAlignLeftClass : containerAlignRightClass; - var getValignClass = function () { - switch (container.valign) { - case 'top': - return containerValignTopClass; - case 'middle': - return containerValignMiddleClass; - case 'bottom': - return containerValignBottomClass; - } - }; - return { - dom: { - tag: 'div', - classes: [ - containerClass, - directionClass, - alignClass, - getValignClass() - ] - }, - components: components - }; - }; - var renderImage = function (src, classes, alt) { - return { - dom: { - tag: 'img', - classes: classes, - attributes: { - src: src, - alt: alt.getOr('') - } - } - }; - }; - - var renderColorStructure = function (itemText, itemValue, iconSvg, providerBackstage) { - var colorPickerCommand = 'custom'; - var removeColorCommand = 'remove'; - var getDom = function () { - var common = colorClass; - var icon = iconSvg.getOr(''); - var attributes = itemText.map(function (text) { - return { title: providerBackstage.translate(text) }; - }).getOr({}); - var baseDom = { - tag: 'div', - attributes: attributes, - classes: [common] - }; - if (itemValue === colorPickerCommand) { - return __assign(__assign({}, baseDom), { - tag: 'button', - classes: __spreadArrays(baseDom.classes, ['tox-swatches__picker-btn']), - innerHtml: icon - }); - } else if (itemValue === removeColorCommand) { - return __assign(__assign({}, baseDom), { - classes: __spreadArrays(baseDom.classes, ['tox-swatch--remove']), - innerHtml: icon - }); - } else { - return __assign(__assign({}, baseDom), { - attributes: __assign(__assign({}, baseDom.attributes), { 'data-mce-color': itemValue }), - styles: { 'background-color': itemValue } - }); - } - }; - return { - dom: getDom(), - optComponents: [] - }; - }; - var renderItemDomStructure = function (rtlClass, ariaLabel) { - var domTitle = ariaLabel.map(function (label) { - return { attributes: { title: global$6.translate(label) } }; - }).getOr({}); - return __assign({ - tag: 'div', - classes: [ - navClass, - selectableClass - ].concat(rtlClass ? [iconClassRtl] : []) - }, domTitle); - }; - var renderNormalItemStructure = function (info, icon, renderIcons, textRender, rtlClass) { - var leftIcon = renderIcons ? icon.or(Optional.some('')).map(renderIcon) : Optional.none(); - var checkmark = info.checkMark; - var content = info.htmlContent.fold(function () { - return info.textContent.map(textRender); - }, function (html) { - return Optional.some(renderHtml(html, [textClass])); - }); - var menuItem = { - dom: renderItemDomStructure(rtlClass, info.ariaLabel), - optComponents: [ - leftIcon, - content, - info.shortcutContent.map(renderShortcut), - checkmark, - info.caret - ] - }; - return menuItem; - }; - var rtlIcon = [ - 'list-num-default', - 'list-num-lower-alpha', - 'list-num-lower-greek', - 'list-num-lower-roman', - 'list-num-upper-alpha', - 'list-num-upper-roman' - ]; - var rtlTransform = [ - 'list-bull-circle', - 'list-bull-default', - 'list-bull-square' - ]; - var renderItemStructure = function (info, providersBackstage, renderIcons, fallbackIcon) { - if (fallbackIcon === void 0) { - fallbackIcon = Optional.none(); - } - var getIconName = function (iconName) { - return iconName.map(function (name) { - return global$6.isRtl() && contains(rtlIcon, name) ? name + '-rtl' : name; - }); - }; - var needRtlClass = global$6.isRtl() && info.iconContent.exists(function (name) { - return contains(rtlTransform, name); - }); - var icon = getIconName(info.iconContent).map(function (iconName) { - return getOr(iconName, providersBackstage.icons, fallbackIcon); - }); - var textRender = Optional.from(info.meta).fold(function () { - return renderText; - }, function (meta) { - return has(meta, 'style') ? curry(renderStyledText, meta.style) : renderText; - }); - if (info.presets === 'color') { - return renderColorStructure(info.ariaLabel, info.value, icon, providersBackstage); - } else { - return renderNormalItemStructure(info, icon, renderIcons, textRender, needRtlClass); - } - }; - - var tooltipBehaviour = function (meta, sharedBackstage) { - return get$1(meta, 'tooltipWorker').map(function (tooltipWorker) { - return [Tooltipping.config({ - lazySink: sharedBackstage.getSink, - tooltipDom: { - tag: 'div', - classes: ['tox-tooltip-worker-container'] - }, - tooltipComponents: [], - anchor: function (comp) { - return { - anchor: 'submenu', - item: comp, - overrides: { maxHeightFunction: expandable } - }; - }, - mode: 'follow-highlight', - onShow: function (component, _tooltip) { - tooltipWorker(function (elm) { - Tooltipping.setComponents(component, [external({ element: SugarElement.fromDom(elm) })]); - }); - } - })]; - }).getOr([]); - }; - var encodeText = function (text) { - return global$5.DOM.encode(text); - }; - var replaceText = function (text, matchText) { - var translated = global$6.translate(text); - var encoded = encodeText(translated); - if (matchText.length > 0) { - var escapedMatchRegex = new RegExp(escape(matchText), 'gi'); - return encoded.replace(escapedMatchRegex, function (match) { - return '' + match + ''; - }); - } else { - return encoded; - } - }; - var renderAutocompleteItem = function (spec, matchText, useText, presets, onItemValueHandler, itemResponse, sharedBackstage, renderIcons) { - if (renderIcons === void 0) { - renderIcons = true; - } - var structure = renderItemStructure({ - presets: presets, - textContent: Optional.none(), - htmlContent: useText ? spec.text.map(function (text) { - return replaceText(text, matchText); - }) : Optional.none(), - ariaLabel: spec.text, - iconContent: spec.icon, - shortcutContent: Optional.none(), - checkMark: Optional.none(), - caret: Optional.none(), - value: spec.value - }, sharedBackstage.providers, renderIcons, spec.icon); - return renderCommonItem({ - data: buildData(spec), - disabled: spec.disabled, - getApi: constant({}), - onAction: function (_api) { - return onItemValueHandler(spec.value, spec.meta); - }, - onSetup: constant(noop), - triggersSubmenu: false, - itemBehaviours: tooltipBehaviour(spec.meta, sharedBackstage) - }, structure, itemResponse, sharedBackstage.providers); - }; - - var render = function (items, extras) { - return map(items, function (item) { - switch (item.type) { - case 'cardcontainer': - return renderContainer(item, render(item.items, extras)); - case 'cardimage': - return renderImage(item.src, item.classes, item.alt); - case 'cardtext': - var shouldHighlight = item.name.exists(function (name) { - return contains(extras.cardText.highlightOn, name); - }); - var matchText = shouldHighlight ? Optional.from(extras.cardText.matchText).getOr('') : ''; - return renderHtml(replaceText(item.text, matchText), item.classes); - } - }); - }; - var renderCardMenuItem = function (spec, itemResponse, sharedBackstage, extras) { - var getApi = function (component) { - return { - isDisabled: function () { - return Disabling.isDisabled(component); - }, - setDisabled: function (state) { - Disabling.set(component, state); - each(descendants(component.element, '*'), function (elm) { - component.getSystem().getByDom(elm).each(function (comp) { - if (comp.hasConfigured(Disabling)) { - Disabling.set(comp, state); - } - }); - }); - } - }; - }; - var structure = { - dom: renderItemDomStructure(false, spec.label), - optComponents: [Optional.some({ - dom: { - tag: 'div', - classes: [ - containerClass, - containerRowClass - ] - }, - components: render(spec.items, extras) - })] - }; - return renderCommonItem({ - data: buildData(__assign({ text: Optional.none() }, spec)), - disabled: spec.disabled, - getApi: getApi, - onAction: spec.onAction, - onSetup: spec.onSetup, - triggersSubmenu: false, - itemBehaviours: Optional.from(extras.itemBehaviours).getOr([]) - }, structure, itemResponse, sharedBackstage.providers); - }; - - var renderChoiceItem = function (spec, useText, presets, onItemValueHandler, isSelected, itemResponse, providersBackstage, renderIcons) { - if (renderIcons === void 0) { - renderIcons = true; - } - var getApi = function (component) { - return { - setActive: function (state) { - Toggling.set(component, state); - }, - isActive: function () { - return Toggling.isOn(component); - }, - isDisabled: function () { - return Disabling.isDisabled(component); - }, - setDisabled: function (state) { - return Disabling.set(component, state); - } - }; - }; - var structure = renderItemStructure({ - presets: presets, - textContent: useText ? spec.text : Optional.none(), - htmlContent: Optional.none(), - ariaLabel: spec.text, - iconContent: spec.icon, - shortcutContent: useText ? spec.shortcut : Optional.none(), - checkMark: useText ? Optional.some(renderCheckmark(providersBackstage.icons)) : Optional.none(), - caret: Optional.none(), - value: spec.value - }, providersBackstage, renderIcons); - return deepMerge(renderCommonItem({ - data: buildData(spec), - disabled: spec.disabled, - getApi: getApi, - onAction: function (_api) { - return onItemValueHandler(spec.value); - }, - onSetup: function (api) { - api.setActive(isSelected); - return noop; - }, - triggersSubmenu: false, - itemBehaviours: [] - }, structure, itemResponse, providersBackstage), { - toggling: { - toggleClass: tickedClass, - toggleOnExecute: false, - selected: spec.active - } - }); - }; - - var parts$2 = generate$4(owner$2(), parts()); - - var hexColour = function (value) { - return { value: value }; - }; - var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; - var longformRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; - var isHexString = function (hex) { - return shorthandRegex.test(hex) || longformRegex.test(hex); - }; - var getLongForm = function (hex) { - var hexString = hex.value.replace(shorthandRegex, function (m, r, g, b) { - return r + r + g + g + b + b; - }); - return { value: hexString }; - }; - var extractValues = function (hex) { - var longForm = getLongForm(hex); - var splitForm = longformRegex.exec(longForm.value); - return splitForm === null ? [ - 'FFFFFF', - 'FF', - 'FF', - 'FF' - ] : splitForm; - }; - var toHex = function (component) { - var hex = component.toString(16); - return (hex.length === 1 ? '0' + hex : hex).toUpperCase(); - }; - var fromRgba = function (rgbaColour) { - var value = toHex(rgbaColour.red) + toHex(rgbaColour.green) + toHex(rgbaColour.blue); - return hexColour(value); - }; - - var min = Math.min; - var max = Math.max; - var round = Math.round; - var rgbRegex = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)/; - var rgbaRegex = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d?(?:\.\d+)?)\)/; - var rgbaColour = function (red, green, blue, alpha) { - return { - red: red, - green: green, - blue: blue, - alpha: alpha - }; - }; - var isRgbaComponent = function (value) { - var num = parseInt(value, 10); - return num.toString() === value && num >= 0 && num <= 255; - }; - var fromHsv = function (hsv) { - var r; - var g; - var b; - var hue = (hsv.hue || 0) % 360; - var saturation = hsv.saturation / 100; - var brightness = hsv.value / 100; - saturation = max(0, min(saturation, 1)); - brightness = max(0, min(brightness, 1)); - if (saturation === 0) { - r = g = b = round(255 * brightness); - return rgbaColour(r, g, b, 1); - } - var side = hue / 60; - var chroma = brightness * saturation; - var x = chroma * (1 - Math.abs(side % 2 - 1)); - var match = brightness - chroma; - switch (Math.floor(side)) { - case 0: - r = chroma; - g = x; - b = 0; - break; - case 1: - r = x; - g = chroma; - b = 0; - break; - case 2: - r = 0; - g = chroma; - b = x; - break; - case 3: - r = 0; - g = x; - b = chroma; - break; - case 4: - r = x; - g = 0; - b = chroma; - break; - case 5: - r = chroma; - g = 0; - b = x; - break; - default: - r = g = b = 0; - } - r = round(255 * (r + match)); - g = round(255 * (g + match)); - b = round(255 * (b + match)); - return rgbaColour(r, g, b, 1); - }; - var fromHex = function (hexColour) { - var result = extractValues(hexColour); - var red = parseInt(result[1], 16); - var green = parseInt(result[2], 16); - var blue = parseInt(result[3], 16); - return rgbaColour(red, green, blue, 1); - }; - var fromStringValues = function (red, green, blue, alpha) { - var r = parseInt(red, 10); - var g = parseInt(green, 10); - var b = parseInt(blue, 10); - var a = parseFloat(alpha); - return rgbaColour(r, g, b, a); - }; - var fromString = function (rgbaString) { - if (rgbaString === 'transparent') { - return Optional.some(rgbaColour(0, 0, 0, 0)); - } - var rgbMatch = rgbRegex.exec(rgbaString); - if (rgbMatch !== null) { - return Optional.some(fromStringValues(rgbMatch[1], rgbMatch[2], rgbMatch[3], '1')); - } - var rgbaMatch = rgbaRegex.exec(rgbaString); - if (rgbaMatch !== null) { - return Optional.some(fromStringValues(rgbaMatch[1], rgbaMatch[2], rgbaMatch[3], rgbaMatch[4])); - } - return Optional.none(); - }; - var toString = function (rgba) { - return 'rgba(' + rgba.red + ',' + rgba.green + ',' + rgba.blue + ',' + rgba.alpha + ')'; - }; - var red = rgbaColour(255, 0, 0, 1); - - var fireSkinLoaded = function (editor) { - return editor.fire('SkinLoaded'); - }; - var fireSkinLoadError = function (editor, error) { - return editor.fire('SkinLoadError', error); - }; - var fireResizeEditor = function (editor) { - return editor.fire('ResizeEditor'); - }; - var fireResizeContent = function (editor, e) { - return editor.fire('ResizeContent', e); - }; - var fireScrollContent = function (editor, e) { - return editor.fire('ScrollContent', e); - }; - var fireTextColorChange = function (editor, data) { - return editor.fire('TextColorChange', data); - }; - - var global$9 = tinymce.util.Tools.resolve('tinymce.util.LocalStorage'); - - var storageName = 'tinymce-custom-colors'; - function ColorCache (max) { - if (max === void 0) { - max = 10; - } - var storageString = global$9.getItem(storageName); - var localstorage = isString(storageString) ? JSON.parse(storageString) : []; - var prune = function (list) { - var diff = max - list.length; - return diff < 0 ? list.slice(0, max) : list; - }; - var cache = prune(localstorage); - var add = function (key) { - indexOf(cache, key).each(remove); - cache.unshift(key); - if (cache.length > max) { - cache.pop(); - } - global$9.setItem(storageName, JSON.stringify(cache)); - }; - var remove = function (idx) { - cache.splice(idx, 1); - }; - var state = function () { - return cache.slice(0); - }; - return { - add: add, - state: state - }; - } - - var choiceItem = 'choiceitem'; - var defaultColors = [ - { - type: choiceItem, - text: 'Light Green', - value: '#BFEDD2' - }, - { - type: choiceItem, - text: 'Light Yellow', - value: '#FBEEB8' - }, - { - type: choiceItem, - text: 'Light Red', - value: '#F8CAC6' - }, - { - type: choiceItem, - text: 'Light Purple', - value: '#ECCAFA' - }, - { - type: choiceItem, - text: 'Light Blue', - value: '#C2E0F4' - }, - { - type: choiceItem, - text: 'Green', - value: '#2DC26B' - }, - { - type: choiceItem, - text: 'Yellow', - value: '#F1C40F' - }, - { - type: choiceItem, - text: 'Red', - value: '#E03E2D' - }, - { - type: choiceItem, - text: 'Purple', - value: '#B96AD9' - }, - { - type: choiceItem, - text: 'Blue', - value: '#3598DB' - }, - { - type: choiceItem, - text: 'Dark Turquoise', - value: '#169179' - }, - { - type: choiceItem, - text: 'Orange', - value: '#E67E23' - }, - { - type: choiceItem, - text: 'Dark Red', - value: '#BA372A' - }, - { - type: choiceItem, - text: 'Dark Purple', - value: '#843FA1' - }, - { - type: choiceItem, - text: 'Dark Blue', - value: '#236FA1' - }, - { - type: choiceItem, - text: 'Light Gray', - value: '#ECF0F1' - }, - { - type: choiceItem, - text: 'Medium Gray', - value: '#CED4D9' - }, - { - type: choiceItem, - text: 'Gray', - value: '#95A5A6' - }, - { - type: choiceItem, - text: 'Dark Gray', - value: '#7E8C8D' - }, - { - type: choiceItem, - text: 'Navy Blue', - value: '#34495E' - }, - { - type: choiceItem, - text: 'Black', - value: '#000000' - }, - { - type: choiceItem, - text: 'White', - value: '#ffffff' - } - ]; - var colorCache = ColorCache(10); - var mapColors = function (colorMap) { - var colors = []; - var canvas = document.createElement('canvas'); - canvas.height = 1; - canvas.width = 1; - var ctx = canvas.getContext('2d'); - var byteAsHex = function (colorByte, alphaByte) { - var bg = 255; - var alpha = alphaByte / 255; - var colorByteWithWhiteBg = Math.round(colorByte * alpha + bg * (1 - alpha)); - return ('0' + colorByteWithWhiteBg.toString(16)).slice(-2).toUpperCase(); - }; - var asHexColor = function (color) { - if (/^[0-9A-Fa-f]{6}$/.test(color)) { - return '#' + color.toUpperCase(); - } - ctx.clearRect(0, 0, canvas.width, canvas.height); - ctx.fillStyle = '#FFFFFF'; - ctx.fillStyle = color; - ctx.fillRect(0, 0, 1, 1); - var rgba = ctx.getImageData(0, 0, 1, 1).data; - var r = rgba[0], g = rgba[1], b = rgba[2], a = rgba[3]; - return '#' + byteAsHex(r, a) + byteAsHex(g, a) + byteAsHex(b, a); - }; - for (var i = 0; i < colorMap.length; i += 2) { - colors.push({ - text: colorMap[i + 1], - value: asHexColor(colorMap[i]), - type: 'choiceitem' - }); - } - return colors; - }; - var getColorCols = function (editor, defaultCols) { - return editor.getParam('color_cols', defaultCols, 'number'); - }; - var hasCustomColors = function (editor) { - return editor.getParam('custom_colors') !== false; - }; - var getColorMap = function (editor) { - return editor.getParam('color_map'); - }; - var getColors = function (editor) { - var unmapped = getColorMap(editor); - return unmapped !== undefined ? mapColors(unmapped) : defaultColors; - }; - var getCurrentColors = function () { - return map(colorCache.state(), function (color) { - return { - type: choiceItem, - text: color, - value: color - }; - }); - }; - var addColor = function (color) { - colorCache.add(color); - }; - - var getCurrentColor = function (editor, format) { - var color; - editor.dom.getParents(editor.selection.getStart(), function (elm) { - var value; - if (value = elm.style[format === 'forecolor' ? 'color' : 'background-color']) { - color = color ? color : value; - } - }); - return color; - }; - var applyFormat = function (editor, format, value) { - editor.undoManager.transact(function () { - editor.focus(); - editor.formatter.apply(format, { value: value }); - editor.nodeChanged(); - }); - }; - var removeFormat = function (editor, format) { - editor.undoManager.transact(function () { - editor.focus(); - editor.formatter.remove(format, { value: null }, null, true); - editor.nodeChanged(); - }); - }; - var registerCommands = function (editor) { - editor.addCommand('mceApplyTextcolor', function (format, value) { - applyFormat(editor, format, value); - }); - editor.addCommand('mceRemoveTextcolor', function (format) { - removeFormat(editor, format); - }); - }; - var calcCols = function (colors) { - return Math.max(5, Math.ceil(Math.sqrt(colors))); - }; - var getColorCols$1 = function (editor) { - var colors = getColors(editor); - var defaultCols = calcCols(colors.length); - return getColorCols(editor, defaultCols); - }; - var getAdditionalColors = function (hasCustom) { - var type = 'choiceitem'; - var remove = { - type: type, - text: 'Remove color', - icon: 'color-swatch-remove-color', - value: 'remove' - }; - var custom = { - type: type, - text: 'Custom color', - icon: 'color-picker', - value: 'custom' - }; - return hasCustom ? [ - remove, - custom - ] : [remove]; - }; - var applyColor = function (editor, format, value, onChoice) { - if (value === 'custom') { - var dialog = colorPickerDialog(editor); - dialog(function (colorOpt) { - colorOpt.each(function (color) { - addColor(color); - editor.execCommand('mceApplyTextcolor', format, color); - onChoice(color); - }); - }, '#000000'); - } else if (value === 'remove') { - onChoice(''); - editor.execCommand('mceRemoveTextcolor', format); - } else { - onChoice(value); - editor.execCommand('mceApplyTextcolor', format, value); - } - }; - var getColors$1 = function (colors, hasCustom) { - return colors.concat(getCurrentColors().concat(getAdditionalColors(hasCustom))); - }; - var getFetch = function (colors, hasCustom) { - return function (callback) { - callback(getColors$1(colors, hasCustom)); - }; - }; - var setIconColor = function (splitButtonApi, name, newColor) { - var id = name === 'forecolor' ? 'tox-icon-text-color__color' : 'tox-icon-highlight-bg-color__color'; - splitButtonApi.setIconFill(id, newColor); - }; - var registerTextColorButton = function (editor, name, format, tooltip, lastColor) { - editor.ui.registry.addSplitButton(name, { - tooltip: tooltip, - presets: 'color', - icon: name === 'forecolor' ? 'text-color' : 'highlight-bg-color', - select: function (value) { - var optCurrentRgb = Optional.from(getCurrentColor(editor, format)); - return optCurrentRgb.bind(function (currentRgb) { - return fromString(currentRgb).map(function (rgba) { - var currentHex = fromRgba(rgba).value; - return contains$1(value.toLowerCase(), currentHex); - }); - }).getOr(false); - }, - columns: getColorCols$1(editor), - fetch: getFetch(getColors(editor), hasCustomColors(editor)), - onAction: function (_splitButtonApi) { - if (lastColor.get() !== null) { - applyColor(editor, format, lastColor.get(), noop); - } - }, - onItemAction: function (_splitButtonApi, value) { - applyColor(editor, format, value, function (newColor) { - lastColor.set(newColor); - fireTextColorChange(editor, { - name: name, - color: newColor - }); - }); - }, - onSetup: function (splitButtonApi) { - if (lastColor.get() !== null) { - setIconColor(splitButtonApi, name, lastColor.get()); - } - var handler = function (e) { - if (e.name === name) { - setIconColor(splitButtonApi, e.name, e.color); - } - }; - editor.on('TextColorChange', handler); - return function () { - editor.off('TextColorChange', handler); - }; - } - }); - }; - var registerTextColorMenuItem = function (editor, name, format, text) { - editor.ui.registry.addNestedMenuItem(name, { - text: text, - icon: name === 'forecolor' ? 'text-color' : 'highlight-bg-color', - getSubmenuItems: function () { - return [{ - type: 'fancymenuitem', - fancytype: 'colorswatch', - onAction: function (data) { - applyColor(editor, format, data.value, noop); - } - }]; - } - }); - }; - var colorPickerDialog = function (editor) { - return function (callback, value) { - var isValid = false; - var onSubmit = function (api) { - var data = api.getData(); - var hex = data.colorpicker; - if (isValid) { - callback(Optional.from(hex)); - api.close(); - } else { - editor.windowManager.alert(editor.translate([ - 'Invalid hex color code: {0}', - hex - ])); - } - }; - var onAction = function (_api, details) { - if (details.name === 'hex-valid') { - isValid = details.value; - } - }; - var initialData = { colorpicker: value }; - editor.windowManager.open({ - title: 'Color Picker', - size: 'normal', - body: { - type: 'panel', - items: [{ - type: 'colorpicker', - name: 'colorpicker', - label: 'Color' - }] - }, - buttons: [ - { - type: 'cancel', - name: 'cancel', - text: 'Cancel' - }, - { - type: 'submit', - name: 'save', - text: 'Save', - primary: true - } - ], - initialData: initialData, - onAction: onAction, - onSubmit: onSubmit, - onClose: noop, - onCancel: function () { - callback(Optional.none()); - } - }); - }; - }; - var register$1 = function (editor) { - registerCommands(editor); - var lastForeColor = Cell(null); - var lastBackColor = Cell(null); - registerTextColorButton(editor, 'forecolor', 'forecolor', 'Text color', lastForeColor); - registerTextColorButton(editor, 'backcolor', 'hilitecolor', 'Background color', lastBackColor); - registerTextColorMenuItem(editor, 'forecolor', 'forecolor', 'Text color'); - registerTextColorMenuItem(editor, 'backcolor', 'hilitecolor', 'Background color'); - }; - - var createPartialChoiceMenu = function (value, items, onItemValueHandler, columns, presets, itemResponse, select, providersBackstage) { - var hasIcons = menuHasIcons(items); - var presetItemTypes = presets !== 'color' ? 'normal' : 'color'; - var alloyItems = createChoiceItems(items, onItemValueHandler, columns, presetItemTypes, itemResponse, select, providersBackstage); - return createPartialMenuWithAlloyItems(value, hasIcons, alloyItems, columns, presets); - }; - var createChoiceItems = function (items, onItemValueHandler, columns, itemPresets, itemResponse, select, providersBackstage) { - return cat(map(items, function (item) { - if (item.type === 'choiceitem') { - return createChoiceMenuItem(item).fold(handleError, function (d) { - return Optional.some(renderChoiceItem(d, columns === 1, itemPresets, onItemValueHandler, select(item.value), itemResponse, providersBackstage, menuHasIcons(items))); - }); - } else { - return Optional.none(); - } - })); - }; - - var deriveMenuMovement = function (columns, presets) { - var menuMarkers = markers$1(presets); - if (columns === 1) { - return { - mode: 'menu', - moveOnTab: true - }; - } else if (columns === 'auto') { - return { - mode: 'grid', - selector: '.' + menuMarkers.item, - initSize: { - numColumns: 1, - numRows: 1 - } - }; - } else { - var rowClass = presets === 'color' ? 'tox-swatches__row' : 'tox-collection__group'; - return { - mode: 'matrix', - rowSelector: '.' + rowClass - }; - } - }; - var deriveCollectionMovement = function (columns, presets) { - if (columns === 1) { - return { - mode: 'menu', - moveOnTab: false, - selector: '.tox-collection__item' - }; - } else if (columns === 'auto') { - return { - mode: 'flatgrid', - selector: '.' + 'tox-collection__item', - initSize: { - numColumns: 1, - numRows: 1 - } - }; - } else { - return { - mode: 'matrix', - selectors: { - row: presets === 'color' ? '.tox-swatches__row' : '.tox-collection__group', - cell: presets === 'color' ? '.' + colorClass : '.' + selectableClass - } - }; - } - }; - - var renderColorSwatchItem = function (spec, backstage) { - var items = getColors$1(backstage.colorinput.getColors(), backstage.colorinput.hasCustomColors()); - var columns = backstage.colorinput.getColorCols(); - var presets = 'color'; - var menuSpec = createPartialChoiceMenu(generate$1('menu-value'), items, function (value) { - spec.onAction({ value: value }); - }, columns, presets, ItemResponse$1.CLOSE_ON_EXECUTE, never, backstage.shared.providers); - var widgetSpec = __assign(__assign({}, menuSpec), { - markers: markers$1(presets), - movement: deriveMenuMovement(columns, presets) - }); - return { - type: 'widget', - data: { value: generate$1('widget-id') }, - dom: { - tag: 'div', - classes: ['tox-fancymenuitem'] - }, - autofocus: true, - components: [parts$2.widget(Menu.sketch(widgetSpec))] - }; - }; - - var cellOverEvent = generate$1('cell-over'); - var cellExecuteEvent = generate$1('cell-execute'); - var makeCell = function (row, col, labelId) { - var _a; - var emitCellOver = function (c) { - return emitWith(c, cellOverEvent, { - row: row, - col: col - }); - }; - var emitExecute = function (c) { - return emitWith(c, cellExecuteEvent, { - row: row, - col: col - }); - }; - var onClick = function (c, se) { - se.stop(); - emitExecute(c); - }; - return build$1({ - dom: { - tag: 'div', - attributes: (_a = { role: 'button' }, _a['aria-labelledby'] = labelId, _a) - }, - behaviours: derive$1([ - config('insert-table-picker-cell', [ - run(mouseover(), Focusing.focus), - run(execute(), emitExecute), - run(click(), onClick), - run(tap(), onClick) - ]), - Toggling.config({ - toggleClass: 'tox-insert-table-picker__selected', - toggleOnExecute: false - }), - Focusing.config({ onFocus: emitCellOver }) - ]) - }); - }; - var makeCells = function (labelId, numRows, numCols) { - var cells = []; - for (var i = 0; i < numRows; i++) { - var row = []; - for (var j = 0; j < numCols; j++) { - row.push(makeCell(i, j, labelId)); - } - cells.push(row); - } - return cells; - }; - var selectCells = function (cells, selectedRow, selectedColumn, numRows, numColumns) { - for (var i = 0; i < numRows; i++) { - for (var j = 0; j < numColumns; j++) { - Toggling.set(cells[i][j], i <= selectedRow && j <= selectedColumn); - } - } - }; - var makeComponents = function (cells) { - return bind(cells, function (cellRow) { - return map(cellRow, premade$1); - }); - }; - var makeLabelText = function (row, col) { - return text(col + 1 + 'x' + (row + 1)); - }; - var renderInsertTableMenuItem = function (spec) { - var numRows = 10; - var numColumns = 10; - var sizeLabelId = generate$1('size-label'); - var cells = makeCells(sizeLabelId, numRows, numColumns); - var memLabel = record({ - dom: { - tag: 'span', - classes: ['tox-insert-table-picker__label'], - attributes: { id: sizeLabelId } - }, - components: [text('0x0')], - behaviours: derive$1([Replacing.config({})]) - }); - return { - type: 'widget', - data: { value: generate$1('widget-id') }, - dom: { - tag: 'div', - classes: ['tox-fancymenuitem'] - }, - autofocus: true, - components: [parts$2.widget({ - dom: { - tag: 'div', - classes: ['tox-insert-table-picker'] - }, - components: makeComponents(cells).concat(memLabel.asSpec()), - behaviours: derive$1([ - config('insert-table-picker', [ - runWithTarget(cellOverEvent, function (c, t, e) { - var row = e.event.row; - var col = e.event.col; - selectCells(cells, row, col, numRows, numColumns); - Replacing.set(memLabel.get(c), [makeLabelText(row, col)]); - }), - runWithTarget(cellExecuteEvent, function (c, _, e) { - spec.onAction({ - numRows: e.event.row + 1, - numColumns: e.event.col + 1 - }); - emit(c, sandboxClose()); - }) - ]), - Keying.config({ - initSize: { - numRows: numRows, - numColumns: numColumns - }, - mode: 'flatgrid', - selector: '[role="button"]' - }) - ]) - })] - }; - }; - - var fancyMenuItems = { - inserttable: renderInsertTableMenuItem, - colorswatch: renderColorSwatchItem - }; - var valueOpt = function (obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key) ? Optional.some(obj[key]) : Optional.none(); - }; - var renderFancyMenuItem = function (spec, backstage) { - return valueOpt(fancyMenuItems, spec.fancytype).map(function (render) { - return render(spec, backstage); - }); - }; - - var renderNestedItem = function (spec, itemResponse, providersBackstage, renderIcons, downwardsCaret) { - if (renderIcons === void 0) { - renderIcons = true; - } - if (downwardsCaret === void 0) { - downwardsCaret = false; - } - var caret = downwardsCaret ? renderDownwardsCaret(providersBackstage.icons) : renderSubmenuCaret(providersBackstage.icons); - var getApi = function (component) { - return { - isDisabled: function () { - return Disabling.isDisabled(component); - }, - setDisabled: function (state) { - return Disabling.set(component, state); - } - }; - }; - var structure = renderItemStructure({ - presets: 'normal', - iconContent: spec.icon, - textContent: spec.text, - htmlContent: Optional.none(), - ariaLabel: spec.text, - caret: Optional.some(caret), - checkMark: Optional.none(), - shortcutContent: spec.shortcut - }, providersBackstage, renderIcons); - return renderCommonItem({ - data: buildData(spec), - getApi: getApi, - disabled: spec.disabled, - onAction: noop, - onSetup: spec.onSetup, - triggersSubmenu: true, - itemBehaviours: [] - }, structure, itemResponse, providersBackstage); - }; - - var renderNormalItem = function (spec, itemResponse, providersBackstage, renderIcons) { - if (renderIcons === void 0) { - renderIcons = true; - } - var getApi = function (component) { - return { - isDisabled: function () { - return Disabling.isDisabled(component); - }, - setDisabled: function (state) { - return Disabling.set(component, state); - } - }; - }; - var structure = renderItemStructure({ - presets: 'normal', - iconContent: spec.icon, - textContent: spec.text, - htmlContent: Optional.none(), - ariaLabel: spec.text, - caret: Optional.none(), - checkMark: Optional.none(), - shortcutContent: spec.shortcut - }, providersBackstage, renderIcons); - return renderCommonItem({ - data: buildData(spec), - getApi: getApi, - disabled: spec.disabled, - onAction: spec.onAction, - onSetup: spec.onSetup, - triggersSubmenu: false, - itemBehaviours: [] - }, structure, itemResponse, providersBackstage); - }; - - var renderSeparatorItem = function (spec) { - var innerHtml = spec.text.fold(function () { - return {}; - }, function (text) { - return { innerHtml: text }; - }); - return { - type: 'separator', - dom: __assign({ - tag: 'div', - classes: [ - selectableClass, - groupHeadingClass - ] - }, innerHtml), - components: [] - }; - }; - - var renderToggleMenuItem = function (spec, itemResponse, providersBackstage, renderIcons) { - if (renderIcons === void 0) { - renderIcons = true; - } - var getApi = function (component) { - return { - setActive: function (state) { - Toggling.set(component, state); - }, - isActive: function () { - return Toggling.isOn(component); - }, - isDisabled: function () { - return Disabling.isDisabled(component); - }, - setDisabled: function (state) { - return Disabling.set(component, state); - } - }; - }; - var structure = renderItemStructure({ - iconContent: spec.icon, - textContent: spec.text, - htmlContent: Optional.none(), - ariaLabel: spec.text, - checkMark: Optional.some(renderCheckmark(providersBackstage.icons)), - caret: Optional.none(), - shortcutContent: spec.shortcut, - presets: 'normal', - meta: spec.meta - }, providersBackstage, renderIcons); - return deepMerge(renderCommonItem({ - data: buildData(spec), - disabled: spec.disabled, - getApi: getApi, - onAction: spec.onAction, - onSetup: spec.onSetup, - triggersSubmenu: false, - itemBehaviours: [] - }, structure, itemResponse, providersBackstage), { - toggling: { - toggleClass: tickedClass, - toggleOnExecute: false, - selected: spec.active - } - }); - }; - - var autocomplete = renderAutocompleteItem; - var separator = renderSeparatorItem; - var normal = renderNormalItem; - var nested = renderNestedItem; - var toggle$1 = renderToggleMenuItem; - var fancy = renderFancyMenuItem; - var card = renderCardMenuItem; - - var FocusMode; - (function (FocusMode) { - FocusMode[FocusMode['ContentFocus'] = 0] = 'ContentFocus'; - FocusMode[FocusMode['UiFocus'] = 1] = 'UiFocus'; - }(FocusMode || (FocusMode = {}))); - var createMenuItemFromBridge = function (item, itemResponse, backstage, menuHasIcons, isHorizontalMenu) { - var providersBackstage = backstage.shared.providers; - var parseForHorizontalMenu = function (menuitem) { - return !isHorizontalMenu ? menuitem : __assign(__assign({}, menuitem), { - shortcut: Optional.none(), - icon: menuitem.text.isSome() ? Optional.none() : menuitem.icon - }); - }; - switch (item.type) { - case 'menuitem': - return createMenuItem(item).fold(handleError, function (d) { - return Optional.some(normal(parseForHorizontalMenu(d), itemResponse, providersBackstage, menuHasIcons)); - }); - case 'nestedmenuitem': - return createNestedMenuItem(item).fold(handleError, function (d) { - return Optional.some(nested(parseForHorizontalMenu(d), itemResponse, providersBackstage, menuHasIcons, isHorizontalMenu)); - }); - case 'togglemenuitem': - return createToggleMenuItem(item).fold(handleError, function (d) { - return Optional.some(toggle$1(parseForHorizontalMenu(d), itemResponse, providersBackstage, menuHasIcons)); - }); - case 'separator': - return createSeparatorMenuItem(item).fold(handleError, function (d) { - return Optional.some(separator(d)); - }); - case 'fancymenuitem': - return createFancyMenuItem(item).fold(handleError, function (d) { - return fancy(parseForHorizontalMenu(d), backstage); - }); - default: { - console.error('Unknown item in general menu', item); - return Optional.none(); - } - } - }; - var createAutocompleteItems = function (items, matchText, onItemValueHandler, columns, itemResponse, sharedBackstage, highlightOn) { - var renderText = columns === 1; - var renderIcons = !renderText || menuHasIcons(items); - return cat(map(items, function (item) { - switch (item.type) { - case 'separator': - return createSeparatorItem(item).fold(handleError, function (d) { - return Optional.some(separator(d)); - }); - case 'cardmenuitem': - return createCardMenuItem(item).fold(handleError, function (d) { - return Optional.some(card(__assign(__assign({}, d), { - onAction: function (api) { - d.onAction(api); - onItemValueHandler(d.value, d.meta); - } - }), itemResponse, sharedBackstage, { - itemBehaviours: tooltipBehaviour(d.meta, sharedBackstage), - cardText: { - matchText: matchText, - highlightOn: highlightOn - } - })); - }); - case 'autocompleteitem': - default: - return createAutocompleterItem(item).fold(handleError, function (d) { - return Optional.some(autocomplete(d, matchText, renderText, 'normal', onItemValueHandler, itemResponse, sharedBackstage, renderIcons)); - }); - } - })); - }; - var createPartialMenu = function (value, items, itemResponse, backstage, isHorizontalMenu) { - var hasIcons = menuHasIcons(items); - var alloyItems = cat(map(items, function (item) { - var itemHasIcon = function (i) { - return isHorizontalMenu ? !i.hasOwnProperty('text') : hasIcons; - }; - var createItem = function (i) { - return createMenuItemFromBridge(i, itemResponse, backstage, itemHasIcon(i), isHorizontalMenu); - }; - if (item.type === 'nestedmenuitem' && item.getSubmenuItems().length <= 0) { - return createItem(__assign(__assign({}, item), { disabled: true })); - } else { - return createItem(item); - } - })); - var createPartial = isHorizontalMenu ? createHorizontalPartialMenuWithAlloyItems : createPartialMenuWithAlloyItems; - return createPartial(value, hasIcons, alloyItems, 1, 'normal'); - }; - var createTieredDataFrom = function (partialMenu) { - return tieredMenu.singleData(partialMenu.value, partialMenu); - }; - var createMenuFrom = function (partialMenu, columns, focusMode, presets) { - var focusManager = focusMode === FocusMode.ContentFocus ? highlights() : dom(); - var movement = deriveMenuMovement(columns, presets); - var menuMarkers = markers$1(presets); - return { - dom: partialMenu.dom, - components: partialMenu.components, - items: partialMenu.items, - value: partialMenu.value, - markers: { - selectedItem: menuMarkers.selectedItem, - item: menuMarkers.item - }, - movement: movement, - fakeFocus: focusMode === FocusMode.ContentFocus, - focusManager: focusManager, - menuBehaviours: SimpleBehaviours.unnamedEvents(columns !== 'auto' ? [] : [runOnAttached(function (comp, _se) { - detectSize(comp, 4, menuMarkers.item).each(function (_a) { - var numColumns = _a.numColumns, numRows = _a.numRows; - Keying.setGridSize(comp, numRows, numColumns); - }); - })]) - }; - }; - - var register$2 = function (editor, sharedBackstage) { - var activeAutocompleter = Cell(Optional.none()); - var processingAction = Cell(false); - var autocompleter = build$1(InlineView.sketch({ - dom: { - tag: 'div', - classes: ['tox-autocompleter'] - }, - components: [], - fireDismissalEventInstead: {}, - inlineBehaviours: derive$1([config('dismissAutocompleter', [run(dismissRequested(), function () { - return cancelIfNecessary(); - })])]), - lazySink: sharedBackstage.getSink - })); - var isMenuOpen = function () { - return InlineView.isOpen(autocompleter); - }; - var isActive = function () { - return activeAutocompleter.get().isSome(); - }; - var hideIfNecessary = function () { - if (isActive()) { - InlineView.hide(autocompleter); - } - }; - var cancelIfNecessary = function () { - if (isActive()) { - var lastElement = activeAutocompleter.get().map(function (ac) { - return ac.element; - }); - detect$4(lastElement.getOr(SugarElement.fromDom(editor.selection.getNode()))).each(unwrap); - hideIfNecessary(); - activeAutocompleter.set(Optional.none()); - processingAction.set(false); - } - }; - var getAutocompleters = cached(function () { - return register(editor); - }); - var getCombinedItems = function (triggerChar, matches) { - var columns = findMap(matches, function (m) { - return Optional.from(m.columns); - }).getOr(1); - return bind(matches, function (match) { - var choices = match.items; - return createAutocompleteItems(choices, match.matchText, function (itemValue, itemMeta) { - var nr = editor.selection.getRng(); - getContext(editor.dom, nr, triggerChar).fold(function () { - return console.error('Lost context. Cursor probably moved'); - }, function (_a) { - var range = _a.range; - var autocompleterApi = { - hide: function () { - cancelIfNecessary(); - }, - reload: function (fetchOptions) { - hideIfNecessary(); - load(fetchOptions); - } - }; - processingAction.set(true); - match.onAction(autocompleterApi, range, itemValue, itemMeta); - processingAction.set(false); - }); - }, columns, ItemResponse$1.BUBBLE_TO_SANDBOX, sharedBackstage, match.highlightOn); - }); - }; - var commenceIfNecessary = function (context) { - if (!isActive()) { - var wrapper = create$4(editor, context.range); - activeAutocompleter.set(Optional.some({ - triggerChar: context.triggerChar, - element: wrapper, - matchLength: context.text.length - })); - processingAction.set(false); - } - }; - var display = function (ac, context, lookupData, items) { - ac.matchLength = context.text.length; - var columns = findMap(lookupData, function (ld) { - return Optional.from(ld.columns); - }).getOr(1); - InlineView.showAt(autocompleter, { - anchor: 'node', - root: SugarElement.fromDom(editor.getBody()), - node: Optional.from(ac.element) - }, Menu.sketch(createMenuFrom(createPartialMenuWithAlloyItems('autocompleter-value', true, items, columns, 'normal'), columns, FocusMode.ContentFocus, 'normal'))); - InlineView.getContent(autocompleter).each(Highlighting.highlightFirst); - }; - var doLookup = function (fetchOptions) { - return activeAutocompleter.get().map(function (ac) { - return getContext(editor.dom, editor.selection.getRng(), ac.triggerChar).bind(function (newContext) { - return lookupWithContext(editor, getAutocompleters, newContext, fetchOptions); - }); - }).getOrThunk(function () { - return lookup(editor, getAutocompleters); - }); - }; - var load = function (fetchOptions) { - doLookup(fetchOptions).fold(cancelIfNecessary, function (lookupInfo) { - commenceIfNecessary(lookupInfo.context); - lookupInfo.lookupData.then(function (lookupData) { - activeAutocompleter.get().map(function (ac) { - var context = lookupInfo.context; - if (ac.triggerChar === context.triggerChar) { - var combinedItems = getCombinedItems(context.triggerChar, lookupData); - if (combinedItems.length > 0) { - display(ac, context, lookupData, combinedItems); - } else if (context.text.length - ac.matchLength >= 10) { - cancelIfNecessary(); - } else { - hideIfNecessary(); - } - } - }); - }); - }); - }; - var onKeypress = last$2(function (e) { - if (e.which === 27) { - return; - } - load(); - }, 50); - var autocompleterUiApi = { - onKeypress: onKeypress, - cancelIfNecessary: cancelIfNecessary, - isMenuOpen: isMenuOpen, - isActive: isActive, - isProcessingAction: processingAction.get, - getView: function () { - return InlineView.getContent(autocompleter); - } - }; - if (editor.hasPlugin('rtc') === false) { - AutocompleterEditorEvents.setup(autocompleterUiApi, editor); - } - }; - var Autocompleter = { register: register$2 }; - - var filter$2 = always; - var bind$3 = function (element, event, handler) { - return bind$2(element, event, filter$2, handler); - }; - var capture$1 = function (element, event, handler) { - return capture(element, event, filter$2, handler); - }; - var fromRawEvent$1 = fromRawEvent; - - var closest$4 = function (scope, selector, isRoot) { - return closest$3(scope, selector, isRoot).isSome(); - }; - - var DelayedFunction = function (fun, delay) { - var ref = null; - var schedule = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - ref = setTimeout(function () { - fun.apply(null, args); - ref = null; - }, delay); - }; - var cancel = function () { - if (ref !== null) { - clearTimeout(ref); - ref = null; - } - }; - return { - cancel: cancel, - schedule: schedule - }; - }; - - var SIGNIFICANT_MOVE = 5; - var LONGPRESS_DELAY = 400; - var getTouch = function (event) { - var raw = event.raw; - if (raw.touches === undefined || raw.touches.length !== 1) { - return Optional.none(); - } - return Optional.some(raw.touches[0]); - }; - var isFarEnough = function (touch, data) { - var distX = Math.abs(touch.clientX - data.x); - var distY = Math.abs(touch.clientY - data.y); - return distX > SIGNIFICANT_MOVE || distY > SIGNIFICANT_MOVE; - }; - var monitor = function (settings) { - var startData = Cell(Optional.none()); - var longpressFired = Cell(false); - var longpress$1 = DelayedFunction(function (event) { - settings.triggerEvent(longpress(), event); - longpressFired.set(true); - }, LONGPRESS_DELAY); - var handleTouchstart = function (event) { - getTouch(event).each(function (touch) { - longpress$1.cancel(); - var data = { - x: touch.clientX, - y: touch.clientY, - target: event.target - }; - longpress$1.schedule(event); - longpressFired.set(false); - startData.set(Optional.some(data)); - }); - return Optional.none(); - }; - var handleTouchmove = function (event) { - longpress$1.cancel(); - getTouch(event).each(function (touch) { - startData.get().each(function (data) { - if (isFarEnough(touch, data)) { - startData.set(Optional.none()); - } - }); - }); - return Optional.none(); - }; - var handleTouchend = function (event) { - longpress$1.cancel(); - var isSame = function (data) { - return eq$1(data.target, event.target); - }; - return startData.get().filter(isSame).map(function (_data) { - if (longpressFired.get()) { - event.prevent(); - return false; - } else { - return settings.triggerEvent(tap(), event); - } - }); - }; - var handlers = wrapAll$1([ - { - key: touchstart(), - value: handleTouchstart - }, - { - key: touchmove(), - value: handleTouchmove - }, - { - key: touchend(), - value: handleTouchend - } - ]); - var fireIfReady = function (event, type) { - return get$1(handlers, type).bind(function (handler) { - return handler(event); - }); - }; - return { fireIfReady: fireIfReady }; - }; - - var isDangerous = function (event) { - var keyEv = event.raw; - return keyEv.which === BACKSPACE[0] && !contains([ - 'input', - 'textarea' - ], name(event.target)) && !closest$4(event.target, '[contenteditable="true"]'); - }; - var isFirefox = function () { - return detect$3().browser.isFirefox(); - }; - var settingsSchema = objOfOnly([ - strictFunction('triggerEvent'), - defaulted$1('stopBackspace', true) - ]); - var bindFocus = function (container, handler) { - if (isFirefox()) { - return capture$1(container, 'focus', handler); - } else { - return bind$3(container, 'focusin', handler); - } - }; - var bindBlur = function (container, handler) { - if (isFirefox()) { - return capture$1(container, 'blur', handler); - } else { - return bind$3(container, 'focusout', handler); - } - }; - var setup$1 = function (container, rawSettings) { - var settings = asRawOrDie('Getting GUI events settings', settingsSchema, rawSettings); - var pointerEvents = [ - 'touchstart', - 'touchmove', - 'touchend', - 'touchcancel', - 'gesturestart', - 'mousedown', - 'mouseup', - 'mouseover', - 'mousemove', - 'mouseout', - 'click' - ]; - var tapEvent = monitor(settings); - var simpleEvents = map(pointerEvents.concat([ - 'selectstart', - 'input', - 'contextmenu', - 'change', - 'transitionend', - 'drag', - 'dragstart', - 'dragend', - 'dragenter', - 'dragleave', - 'dragover', - 'drop', - 'keyup' - ]), function (type) { - return bind$3(container, type, function (event) { - tapEvent.fireIfReady(event, type).each(function (tapStopped) { - if (tapStopped) { - event.kill(); - } - }); - var stopped = settings.triggerEvent(type, event); - if (stopped) { - event.kill(); - } - }); - }); - var pasteTimeout = Cell(Optional.none()); - var onPaste = bind$3(container, 'paste', function (event) { - tapEvent.fireIfReady(event, 'paste').each(function (tapStopped) { - if (tapStopped) { - event.kill(); - } - }); - var stopped = settings.triggerEvent('paste', event); - if (stopped) { - event.kill(); - } - pasteTimeout.set(Optional.some(setTimeout(function () { - settings.triggerEvent(postPaste(), event); - }, 0))); - }); - var onKeydown = bind$3(container, 'keydown', function (event) { - var stopped = settings.triggerEvent('keydown', event); - if (stopped) { - event.kill(); - } else if (settings.stopBackspace === true && isDangerous(event)) { - event.prevent(); - } - }); - var onFocusIn = bindFocus(container, function (event) { - var stopped = settings.triggerEvent('focusin', event); - if (stopped) { - event.kill(); - } - }); - var focusoutTimeout = Cell(Optional.none()); - var onFocusOut = bindBlur(container, function (event) { - var stopped = settings.triggerEvent('focusout', event); - if (stopped) { - event.kill(); - } - focusoutTimeout.set(Optional.some(setTimeout(function () { - settings.triggerEvent(postBlur(), event); - }, 0))); - }); - var unbind = function () { - each(simpleEvents, function (e) { - e.unbind(); - }); - onKeydown.unbind(); - onFocusIn.unbind(); - onFocusOut.unbind(); - onPaste.unbind(); - pasteTimeout.get().each(clearTimeout); - focusoutTimeout.get().each(clearTimeout); - }; - return { unbind: unbind }; - }; - - var derive$2 = function (rawEvent, rawTarget) { - var source = get$1(rawEvent, 'target').getOr(rawTarget); - return Cell(source); - }; - - var fromSource = function (event, source) { - var stopper = Cell(false); - var cutter = Cell(false); - var stop = function () { - stopper.set(true); - }; - var cut = function () { - cutter.set(true); - }; - return { - stop: stop, - cut: cut, - isStopped: stopper.get, - isCut: cutter.get, - event: event, - setSource: source.set, - getSource: source.get - }; - }; - var fromExternal = function (event) { - var stopper = Cell(false); - var stop = function () { - stopper.set(true); - }; - return { - stop: stop, - cut: noop, - isStopped: stopper.get, - isCut: never, - event: event, - setSource: die('Cannot set source of a broadcasted event'), - getSource: die('Cannot get source of a broadcasted event') - }; - }; - - var adt$b = Adt.generate([ - { stopped: [] }, - { resume: ['element'] }, - { complete: [] } - ]); - var doTriggerHandler = function (lookup, eventType, rawEvent, target, source, logger) { - var handler = lookup(eventType, target); - var simulatedEvent = fromSource(rawEvent, source); - return handler.fold(function () { - logger.logEventNoHandlers(eventType, target); - return adt$b.complete(); - }, function (handlerInfo) { - var descHandler = handlerInfo.descHandler; - var eventHandler = getCurried(descHandler); - eventHandler(simulatedEvent); - if (simulatedEvent.isStopped()) { - logger.logEventStopped(eventType, handlerInfo.element, descHandler.purpose); - return adt$b.stopped(); - } else if (simulatedEvent.isCut()) { - logger.logEventCut(eventType, handlerInfo.element, descHandler.purpose); - return adt$b.complete(); - } else { - return parent(handlerInfo.element).fold(function () { - logger.logNoParent(eventType, handlerInfo.element, descHandler.purpose); - return adt$b.complete(); - }, function (parent) { - logger.logEventResponse(eventType, handlerInfo.element, descHandler.purpose); - return adt$b.resume(parent); - }); - } - }); - }; - var doTriggerOnUntilStopped = function (lookup, eventType, rawEvent, rawTarget, source, logger) { - return doTriggerHandler(lookup, eventType, rawEvent, rawTarget, source, logger).fold(always, function (parent) { - return doTriggerOnUntilStopped(lookup, eventType, rawEvent, parent, source, logger); - }, never); - }; - var triggerHandler = function (lookup, eventType, rawEvent, target, logger) { - var source = derive$2(rawEvent, target); - return doTriggerHandler(lookup, eventType, rawEvent, target, source, logger); - }; - var broadcast = function (listeners, rawEvent, _logger) { - var simulatedEvent = fromExternal(rawEvent); - each(listeners, function (listener) { - var descHandler = listener.descHandler; - var handler = getCurried(descHandler); - handler(simulatedEvent); - }); - return simulatedEvent.isStopped(); - }; - var triggerUntilStopped = function (lookup, eventType, rawEvent, logger) { - return triggerOnUntilStopped(lookup, eventType, rawEvent, rawEvent.target, logger); - }; - var triggerOnUntilStopped = function (lookup, eventType, rawEvent, rawTarget, logger) { - var source = derive$2(rawEvent, rawTarget); - return doTriggerOnUntilStopped(lookup, eventType, rawEvent, rawTarget, source, logger); - }; - - var eventHandler = function (element, descHandler) { - return { - element: element, - descHandler: descHandler - }; - }; - var broadcastHandler = function (id, handler) { - return { - id: id, - descHandler: handler - }; - }; - var EventRegistry = function () { - var registry = {}; - var registerId = function (extraArgs, id, events) { - each$1(events, function (v, k) { - var handlers = registry[k] !== undefined ? registry[k] : {}; - handlers[id] = curryArgs(v, extraArgs); - registry[k] = handlers; - }); - }; - var findHandler = function (handlers, elem) { - return read$1(elem).fold(function () { - return Optional.none(); - }, function (id) { - return handlers.bind(function (h) { - return get$1(h, id); - }).map(function (descHandler) { - return eventHandler(elem, descHandler); - }); - }); - }; - var filterByType = function (type) { - return get$1(registry, type).map(function (handlers) { - return mapToArray(handlers, function (f, id) { - return broadcastHandler(id, f); - }); - }).getOr([]); - }; - var find = function (isAboveRoot, type, target) { - var handlers = get$1(registry, type); - return closest(target, function (elem) { - return findHandler(handlers, elem); - }, isAboveRoot); - }; - var unregisterId = function (id) { - each$1(registry, function (handlersById, _eventName) { - if (handlersById.hasOwnProperty(id)) { - delete handlersById[id]; - } - }); - }; - return { - registerId: registerId, - unregisterId: unregisterId, - filterByType: filterByType, - find: find - }; - }; - - var Registry = function () { - var events = EventRegistry(); - var components = {}; - var readOrTag = function (component) { - var elem = component.element; - return read$1(elem).fold(function () { - return write('uid-', component.element); - }, function (uid) { - return uid; - }); - }; - var failOnDuplicate = function (component, tagId) { - var conflict = components[tagId]; - if (conflict === component) { - unregister(component); - } else { - throw new Error('The tagId "' + tagId + '" is already used by: ' + element(conflict.element) + '\nCannot use it for: ' + element(component.element) + '\n' + 'The conflicting element is' + (inBody(conflict.element) ? ' ' : ' not ') + 'already in the DOM'); - } - }; - var register = function (component) { - var tagId = readOrTag(component); - if (hasNonNullableKey(components, tagId)) { - failOnDuplicate(component, tagId); - } - var extraArgs = [component]; - events.registerId(extraArgs, tagId, component.events); - components[tagId] = component; - }; - var unregister = function (component) { - read$1(component.element).each(function (tagId) { - delete components[tagId]; - events.unregisterId(tagId); - }); - }; - var filter = function (type) { - return events.filterByType(type); - }; - var find = function (isAboveRoot, type, target) { - return events.find(isAboveRoot, type, target); - }; - var getById = function (id) { - return get$1(components, id); - }; - return { - find: find, - filter: filter, - register: register, - unregister: unregister, - getById: getById - }; - }; - - var factory$3 = function (detail) { - var _a = detail.dom, attributes = _a.attributes, domWithoutAttributes = __rest(_a, ['attributes']); - return { - uid: detail.uid, - dom: __assign({ - tag: 'div', - attributes: __assign({ role: 'presentation' }, attributes) - }, domWithoutAttributes), - components: detail.components, - behaviours: get$d(detail.containerBehaviours), - events: detail.events, - domModification: detail.domModification, - eventOrder: detail.eventOrder - }; - }; - var Container = single$2({ - name: 'Container', - factory: factory$3, - configFields: [ - defaulted$1('components', []), - field$1('containerBehaviours', []), - defaulted$1('events', {}), - defaulted$1('domModification', {}), - defaulted$1('eventOrder', {}) - ] - }); - - var takeover = function (root) { - var isAboveRoot = function (el) { - return parent(root.element).fold(always, function (parent) { - return eq$1(el, parent); - }); - }; - var registry = Registry(); - var lookup = function (eventName, target) { - return registry.find(isAboveRoot, eventName, target); - }; - var domEvents = setup$1(root.element, { - triggerEvent: function (eventName, event) { - return monitorEvent(eventName, event.target, function (logger) { - return triggerUntilStopped(lookup, eventName, event, logger); - }); - } - }); - var systemApi = { - debugInfo: constant('real'), - triggerEvent: function (eventName, target, data) { - monitorEvent(eventName, target, function (logger) { - return triggerOnUntilStopped(lookup, eventName, data, target, logger); - }); - }, - triggerFocus: function (target, originator) { - read$1(target).fold(function () { - focus$1(target); - }, function (_alloyId) { - monitorEvent(focus(), target, function (logger) { - triggerHandler(lookup, focus(), { - originator: originator, - kill: noop, - prevent: noop, - target: target - }, target, logger); - return false; - }); - }); - }, - triggerEscape: function (comp, simulatedEvent) { - systemApi.triggerEvent('keydown', comp.element, simulatedEvent.event); - }, - getByUid: function (uid) { - return getByUid(uid); - }, - getByDom: function (elem) { - return getByDom(elem); - }, - build: build$1, - addToGui: function (c) { - add(c); - }, - removeFromGui: function (c) { - remove$1(c); - }, - addToWorld: function (c) { - addToWorld(c); - }, - removeFromWorld: function (c) { - removeFromWorld(c); - }, - broadcast: function (message) { - broadcast$1(message); - }, - broadcastOn: function (channels, message) { - broadcastOn(channels, message); - }, - broadcastEvent: function (eventName, event) { - broadcastEvent(eventName, event); - }, - isConnected: always - }; - var addToWorld = function (component) { - component.connect(systemApi); - if (!isText(component.element)) { - registry.register(component); - each(component.components(), addToWorld); - systemApi.triggerEvent(systemInit(), component.element, { target: component.element }); - } - }; - var removeFromWorld = function (component) { - if (!isText(component.element)) { - each(component.components(), removeFromWorld); - registry.unregister(component); - } - component.disconnect(); - }; - var add = function (component) { - attach$1(root, component); - }; - var remove$1 = function (component) { - detach(component); - }; - var destroy = function () { - domEvents.unbind(); - remove(root.element); - }; - var broadcastData = function (data) { - var receivers = registry.filter(receive()); - each(receivers, function (receiver) { - var descHandler = receiver.descHandler; - var handler = getCurried(descHandler); - handler(data); - }); - }; - var broadcast$1 = function (message) { - broadcastData({ - universal: true, - data: message - }); - }; - var broadcastOn = function (channels, message) { - broadcastData({ - universal: false, - channels: channels, - data: message - }); - }; - var broadcastEvent = function (eventName, event) { - var listeners = registry.filter(eventName); - return broadcast(listeners, event); - }; - var getByUid = function (uid) { - return registry.getById(uid).fold(function () { - return Result.error(new Error('Could not find component with uid: "' + uid + '" in system.')); - }, Result.value); - }; - var getByDom = function (elem) { - var uid = read$1(elem).getOr('not found'); - return getByUid(uid); - }; - addToWorld(root); - return { - root: root, - element: root.element, - destroy: destroy, - add: add, - remove: remove$1, - getByUid: getByUid, - getByDom: getByDom, - addToWorld: addToWorld, - removeFromWorld: removeFromWorld, - broadcast: broadcast$1, - broadcastOn: broadcastOn, - broadcastEvent: broadcastEvent - }; - }; - - var renderBar = function (spec, backstage) { - return { - dom: { - tag: 'div', - classes: [ - 'tox-bar', - 'tox-form__controls-h-stack' - ] - }, - components: map(spec.items, backstage.interpreter) - }; - }; - - var schema$e = constant([ - defaulted$1('prefix', 'form-field'), - field$1('fieldBehaviours', [ - Composing, - Representing - ]) - ]); - var parts$3 = constant([ - optional({ - schema: [strict$1('dom')], - name: 'label' - }), - optional({ - factory: { - sketch: function (spec) { - return { - uid: spec.uid, - dom: { - tag: 'span', - styles: { display: 'none' }, - attributes: { 'aria-hidden': 'true' }, - innerHtml: spec.text - } - }; - } - }, - schema: [strict$1('text')], - name: 'aria-descriptor' - }), - required({ - factory: { - sketch: function (spec) { - var excludeFactory = exclude$1(spec, ['factory']); - return spec.factory.sketch(excludeFactory); - } - }, - schema: [strict$1('factory')], - name: 'field' - }) - ]); - - var factory$4 = function (detail, components, _spec, _externals) { - var behaviours = augment(detail.fieldBehaviours, [ - Composing.config({ - find: function (container) { - return getPart(container, detail, 'field'); - } - }), - Representing.config({ - store: { - mode: 'manual', - getValue: function (field) { - return Composing.getCurrent(field).bind(Representing.getValue); - }, - setValue: function (field, value) { - Composing.getCurrent(field).each(function (current) { - Representing.setValue(current, value); - }); - } - } - }) - ]); - var events = derive([runOnAttached(function (component, _simulatedEvent) { - var ps = getParts(component, detail, [ - 'label', - 'field', - 'aria-descriptor' - ]); - ps.field().each(function (field) { - var id = generate$1(detail.prefix); - ps.label().each(function (label) { - set$1(label.element, 'for', id); - set$1(field.element, 'id', id); - }); - ps['aria-descriptor']().each(function (descriptor) { - var descriptorId = generate$1(detail.prefix); - set$1(descriptor.element, 'id', descriptorId); - set$1(field.element, 'aria-describedby', descriptorId); - }); - }); - })]); - var apis = { - getField: function (container) { - return getPart(container, detail, 'field'); - }, - getLabel: function (container) { - return getPart(container, detail, 'label'); - } - }; - return { - uid: detail.uid, - dom: detail.dom, - components: components, - behaviours: behaviours, - events: events, - apis: apis - }; - }; - var FormField = composite$1({ - name: 'FormField', - configFields: schema$e(), - partFields: parts$3(), - factory: factory$4, - apis: { - getField: function (apis, comp) { - return apis.getField(comp); - }, - getLabel: function (apis, comp) { - return apis.getLabel(comp); - } - } - }); - - var exhibit$4 = function (base, tabConfig) { - return nu$6({ - attributes: wrapAll$1([{ - key: tabConfig.tabAttr, - value: 'true' - }]) - }); - }; - - var ActiveTabstopping = /*#__PURE__*/Object.freeze({ - __proto__: null, - exhibit: exhibit$4 - }); - - var TabstopSchema = [defaulted$1('tabAttr', 'data-alloy-tabstop')]; - - var Tabstopping = create$1({ - fields: TabstopSchema, - name: 'tabstopping', - active: ActiveTabstopping - }); - - var global$a = tinymce.util.Tools.resolve('tinymce.html.Entities'); - - var renderFormFieldWith = function (pLabel, pField, extraClasses, extraBehaviours) { - var spec = renderFormFieldSpecWith(pLabel, pField, extraClasses, extraBehaviours); - return FormField.sketch(spec); - }; - var renderFormField = function (pLabel, pField) { - return renderFormFieldWith(pLabel, pField, [], []); - }; - var renderFormFieldSpecWith = function (pLabel, pField, extraClasses, extraBehaviours) { - return { - dom: renderFormFieldDomWith(extraClasses), - components: pLabel.toArray().concat([pField]), - fieldBehaviours: derive$1(extraBehaviours) - }; - }; - var renderFormFieldDom = function () { - return renderFormFieldDomWith([]); - }; - var renderFormFieldDomWith = function (extraClasses) { - return { - tag: 'div', - classes: ['tox-form__group'].concat(extraClasses) - }; - }; - var renderLabel = function (label, providersBackstage) { - return FormField.parts.label({ - dom: { - tag: 'label', - classes: ['tox-label'], - innerHtml: providersBackstage.translate(label) - } - }); - }; - - var formChangeEvent = generate$1('form-component-change'); - var formCloseEvent = generate$1('form-close'); - var formCancelEvent = generate$1('form-cancel'); - var formActionEvent = generate$1('form-action'); - var formSubmitEvent = generate$1('form-submit'); - var formBlockEvent = generate$1('form-block'); - var formUnblockEvent = generate$1('form-unblock'); - var formTabChangeEvent = generate$1('form-tabchange'); - var formResizeEvent = generate$1('form-resize'); - - var renderCollection = function (spec, providersBackstage) { - var _a; - var pLabel = spec.label.map(function (label) { - return renderLabel(label, providersBackstage); - }); - var runOnItem = function (f) { - return function (comp, se) { - closest$3(se.event.target, '[data-collection-item-value]').each(function (target) { - f(comp, se, target, get$3(target, 'data-collection-item-value')); - }); - }; - }; - var setContents = function (comp, items) { - var htmlLines = map(items, function (item) { - var itemText = global$6.translate(item.text); - var textContent = spec.columns === 1 ? '
' + itemText + '
' : ''; - var iconContent = '
' + item.icon + '
'; - var mapItemName = { - '_': ' ', - ' - ': ' ', - '-': ' ' - }; - var ariaLabel = itemText.replace(/\_| \- |\-/g, function (match) { - return mapItemName[match]; - }); - var disabledClass = providersBackstage.isDisabled() ? ' tox-collection__item--state-disabled' : ''; - return '
' + iconContent + textContent + '
'; - }); - var chunks = spec.columns !== 'auto' && spec.columns > 1 ? chunk(htmlLines, spec.columns) : [htmlLines]; - var html = map(chunks, function (ch) { - return '
' + ch.join('') + '
'; - }); - set(comp.element, html.join('')); - }; - var onClick = runOnItem(function (comp, se, tgt, itemValue) { - se.stop(); - if (!providersBackstage.isDisabled()) { - emitWith(comp, formActionEvent, { - name: spec.name, - value: itemValue - }); - } - }); - var collectionEvents = [ - run(mouseover(), runOnItem(function (comp, se, tgt) { - focus$1(tgt); - })), - run(click(), onClick), - run(tap(), onClick), - run(focusin(), runOnItem(function (comp, se, tgt) { - descendant$1(comp.element, '.' + activeClass).each(function (currentActive) { - remove$4(currentActive, activeClass); - }); - add$2(tgt, activeClass); - })), - run(focusout(), runOnItem(function (comp) { - descendant$1(comp.element, '.' + activeClass).each(function (currentActive) { - remove$4(currentActive, activeClass); - }); - })), - runOnExecute(runOnItem(function (comp, se, tgt, itemValue) { - emitWith(comp, formActionEvent, { - name: spec.name, - value: itemValue - }); - })) - ]; - var iterCollectionItems = function (comp, applyAttributes) { - return map(descendants(comp.element, '.tox-collection__item'), applyAttributes); - }; - var pField = FormField.parts.field({ - dom: { - tag: 'div', - classes: ['tox-collection'].concat(spec.columns !== 1 ? ['tox-collection--grid'] : ['tox-collection--list']) - }, - components: [], - factory: { sketch: identity }, - behaviours: derive$1([ - Disabling.config({ - disabled: providersBackstage.isDisabled, - onDisabled: function (comp) { - iterCollectionItems(comp, function (childElm) { - add$2(childElm, 'tox-collection__item--state-disabled'); - set$1(childElm, 'aria-disabled', true); - }); - }, - onEnabled: function (comp) { - iterCollectionItems(comp, function (childElm) { - remove$4(childElm, 'tox-collection__item--state-disabled'); - remove$1(childElm, 'aria-disabled'); - }); - } - }), - receivingConfig(), - Replacing.config({}), - Representing.config({ - store: { - mode: 'memory', - initialValue: [] - }, - onSetValue: function (comp, items) { - setContents(comp, items); - if (spec.columns === 'auto') { - detectSize(comp, 5, 'tox-collection__item').each(function (_a) { - var numRows = _a.numRows, numColumns = _a.numColumns; - Keying.setGridSize(comp, numRows, numColumns); - }); - } - emit(comp, formResizeEvent); - } - }), - Tabstopping.config({}), - Keying.config(deriveCollectionMovement(spec.columns, 'normal')), - config('collection-events', collectionEvents) - ]), - eventOrder: (_a = {}, _a[execute()] = [ - 'disabling', - 'alloy.base.behaviour', - 'collection-events' - ], _a) - }); - var extraClasses = ['tox-form__group--collection']; - return renderFormFieldWith(pLabel, pField, extraClasses, []); - }; - - var schema$f = constant([ - option('data'), - defaulted$1('inputAttributes', {}), - defaulted$1('inputStyles', {}), - defaulted$1('tag', 'input'), - defaulted$1('inputClasses', []), - onHandler('onSetValue'), - defaulted$1('styles', {}), - defaulted$1('eventOrder', {}), - field$1('inputBehaviours', [ - Representing, - Focusing - ]), - defaulted$1('selectOnFocus', true) - ]); - var focusBehaviours = function (detail) { - return derive$1([Focusing.config({ - onFocus: !detail.selectOnFocus ? noop : function (component) { - var input = component.element; - var value = get$6(input); - input.dom.setSelectionRange(0, value.length); - } - })]); - }; - var behaviours = function (detail) { - return __assign(__assign({}, focusBehaviours(detail)), augment(detail.inputBehaviours, [Representing.config({ - store: __assign(__assign({ mode: 'manual' }, detail.data.map(function (data) { - return { initialValue: data }; - }).getOr({})), { - getValue: function (input) { - return get$6(input.element); - }, - setValue: function (input, data) { - var current = get$6(input.element); - if (current !== data) { - set$3(input.element, data); - } - } - }), - onSetValue: detail.onSetValue - })])); - }; - var dom$2 = function (detail) { - return { - tag: detail.tag, - attributes: __assign({ type: 'text' }, detail.inputAttributes), - styles: detail.inputStyles, - classes: detail.inputClasses - }; - }; - - var factory$5 = function (detail, _spec) { - return { - uid: detail.uid, - dom: dom$2(detail), - components: [], - behaviours: behaviours(detail), - eventOrder: detail.eventOrder - }; - }; - var Input = single$2({ - name: 'Input', - configFields: schema$f(), - factory: factory$5 - }); - - var exports$1 = {}, module = { exports: exports$1 }; - (function (define, exports, module, require) { - (function (f) { - if (typeof exports === 'object' && typeof module !== 'undefined') { - module.exports = f(); - } else if (typeof define === 'function' && define.amd) { - define([], f); - } else { - var g; - if (typeof window !== 'undefined') { - g = window; - } else if (typeof global !== 'undefined') { - g = global; - } else if (typeof self !== 'undefined') { - g = self; - } else { - g = this; - } - g.EphoxContactWrapper = f(); - } - }(function () { - return function () { - function r(e, n, t) { - function o(i, f) { - if (!n[i]) { - if (!e[i]) { - var c = 'function' == typeof require && require; - if (!f && c) - return c(i, !0); - if (u) - return u(i, !0); - var a = new Error('Cannot find module \'' + i + '\''); - throw a.code = 'MODULE_NOT_FOUND', a; - } - var p = n[i] = { exports: {} }; - e[i][0].call(p.exports, function (r) { - var n = e[i][1][r]; - return o(n || r); - }, p, p.exports, r, e, n, t); - } - return n[i].exports; - } - for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++) - o(t[i]); - return o; - } - return r; - }()({ - 1: [ - function (require, module, exports) { - var process = module.exports = {}; - var cachedSetTimeout; - var cachedClearTimeout; - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); - } - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - }()); - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - return setTimeout(fun, 0); - } - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - return cachedSetTimeout.call(this, fun, 0); - } - } - } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - return clearTimeout(marker); - } - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - return cachedClearTimeout(marker); - } catch (e) { - try { - return cachedClearTimeout.call(null, marker); - } catch (e) { - return cachedClearTimeout.call(this, marker); - } - } - } - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } - } - function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - var len = queue.length; - while (len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; - process.versions = {}; - function noop() { - } - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - process.prependListener = noop; - process.prependOnceListener = noop; - process.listeners = function (name) { - return []; - }; - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; - process.cwd = function () { - return '/'; - }; - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - process.umask = function () { - return 0; - }; - }, - {} - ], - 2: [ - function (require, module, exports) { - (function (setImmediate) { - (function (root) { - var setTimeoutFunc = setTimeout; - function noop() { - } - function bind(fn, thisArg) { - return function () { - fn.apply(thisArg, arguments); - }; - } - function Promise(fn) { - if (typeof this !== 'object') - throw new TypeError('Promises must be constructed via new'); - if (typeof fn !== 'function') - throw new TypeError('not a function'); - this._state = 0; - this._handled = false; - this._value = undefined; - this._deferreds = []; - doResolve(fn, this); - } - function handle(self, deferred) { - while (self._state === 3) { - self = self._value; - } - if (self._state === 0) { - self._deferreds.push(deferred); - return; - } - self._handled = true; - Promise._immediateFn(function () { - var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; - if (cb === null) { - (self._state === 1 ? resolve : reject)(deferred.promise, self._value); - return; - } - var ret; - try { - ret = cb(self._value); - } catch (e) { - reject(deferred.promise, e); - return; - } - resolve(deferred.promise, ret); - }); - } - function resolve(self, newValue) { - try { - if (newValue === self) - throw new TypeError('A promise cannot be resolved with itself.'); - if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { - var then = newValue.then; - if (newValue instanceof Promise) { - self._state = 3; - self._value = newValue; - finale(self); - return; - } else if (typeof then === 'function') { - doResolve(bind(then, newValue), self); - return; - } - } - self._state = 1; - self._value = newValue; - finale(self); - } catch (e) { - reject(self, e); - } - } - function reject(self, newValue) { - self._state = 2; - self._value = newValue; - finale(self); - } - function finale(self) { - if (self._state === 2 && self._deferreds.length === 0) { - Promise._immediateFn(function () { - if (!self._handled) { - Promise._unhandledRejectionFn(self._value); - } - }); - } - for (var i = 0, len = self._deferreds.length; i < len; i++) { - handle(self, self._deferreds[i]); - } - self._deferreds = null; - } - function Handler(onFulfilled, onRejected, promise) { - this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; - this.onRejected = typeof onRejected === 'function' ? onRejected : null; - this.promise = promise; - } - function doResolve(fn, self) { - var done = false; - try { - fn(function (value) { - if (done) - return; - done = true; - resolve(self, value); - }, function (reason) { - if (done) - return; - done = true; - reject(self, reason); - }); - } catch (ex) { - if (done) - return; - done = true; - reject(self, ex); - } - } - Promise.prototype['catch'] = function (onRejected) { - return this.then(null, onRejected); - }; - Promise.prototype.then = function (onFulfilled, onRejected) { - var prom = new this.constructor(noop); - handle(this, new Handler(onFulfilled, onRejected, prom)); - return prom; - }; - Promise.all = function (arr) { - var args = Array.prototype.slice.call(arr); - return new Promise(function (resolve, reject) { - if (args.length === 0) - return resolve([]); - var remaining = args.length; - function res(i, val) { - try { - if (val && (typeof val === 'object' || typeof val === 'function')) { - var then = val.then; - if (typeof then === 'function') { - then.call(val, function (val) { - res(i, val); - }, reject); - return; - } - } - args[i] = val; - if (--remaining === 0) { - resolve(args); - } - } catch (ex) { - reject(ex); - } - } - for (var i = 0; i < args.length; i++) { - res(i, args[i]); - } - }); - }; - Promise.resolve = function (value) { - if (value && typeof value === 'object' && value.constructor === Promise) { - return value; - } - return new Promise(function (resolve) { - resolve(value); - }); - }; - Promise.reject = function (value) { - return new Promise(function (resolve, reject) { - reject(value); - }); - }; - Promise.race = function (values) { - return new Promise(function (resolve, reject) { - for (var i = 0, len = values.length; i < len; i++) { - values[i].then(resolve, reject); - } - }); - }; - Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) { - setImmediate(fn); - } : function (fn) { - setTimeoutFunc(fn, 0); - }; - Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { - if (typeof console !== 'undefined' && console) { - console.warn('Possible Unhandled Promise Rejection:', err); - } - }; - Promise._setImmediateFn = function _setImmediateFn(fn) { - Promise._immediateFn = fn; - }; - Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) { - Promise._unhandledRejectionFn = fn; - }; - if (typeof module !== 'undefined' && module.exports) { - module.exports = Promise; - } else if (!root.Promise) { - root.Promise = Promise; - } - }(this)); - }.call(this, require('timers').setImmediate)); - }, - { 'timers': 3 } - ], - 3: [ - function (require, module, exports) { - (function (setImmediate, clearImmediate) { - var nextTick = require('process/browser.js').nextTick; - var apply = Function.prototype.apply; - var slice = Array.prototype.slice; - var immediateIds = {}; - var nextImmediateId = 0; - exports.setTimeout = function () { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); - }; - exports.setInterval = function () { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); - }; - exports.clearTimeout = exports.clearInterval = function (timeout) { - timeout.close(); - }; - function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; - } - Timeout.prototype.unref = Timeout.prototype.ref = function () { - }; - Timeout.prototype.close = function () { - this._clearFn.call(window, this._id); - }; - exports.enroll = function (item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; - }; - exports.unenroll = function (item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; - }; - exports._unrefActive = exports.active = function (item) { - clearTimeout(item._idleTimeoutId); - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } - }; - exports.setImmediate = typeof setImmediate === 'function' ? setImmediate : function (fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); - immediateIds[id] = true; - nextTick(function onNextTick() { - if (immediateIds[id]) { - if (args) { - fn.apply(null, args); - } else { - fn.call(null); - } - exports.clearImmediate(id); - } - }); - return id; - }; - exports.clearImmediate = typeof clearImmediate === 'function' ? clearImmediate : function (id) { - delete immediateIds[id]; - }; - }.call(this, require('timers').setImmediate, require('timers').clearImmediate)); - }, - { - 'process/browser.js': 1, - 'timers': 3 - } - ], - 4: [ - function (require, module, exports) { - var promisePolyfill = require('promise-polyfill'); - var Global = function () { - if (typeof window !== 'undefined') { - return window; - } else { - return Function('return this;')(); - } - }(); - module.exports = { boltExport: Global.Promise || promisePolyfill }; - }, - { 'promise-polyfill': 2 } - ] - }, {}, [4])(4); - })); - }(undefined, exports$1, module, undefined)); - var Promise = module.exports.boltExport; - - var nu$a = function (baseFn) { - var data = Optional.none(); - var callbacks = []; - var map = function (f) { - return nu$a(function (nCallback) { - get(function (data) { - nCallback(f(data)); - }); - }); - }; - var get = function (nCallback) { - if (isReady()) { - call(nCallback); - } else { - callbacks.push(nCallback); - } - }; - var set = function (x) { - if (!isReady()) { - data = Optional.some(x); - run(callbacks); - callbacks = []; - } - }; - var isReady = function () { - return data.isSome(); - }; - var run = function (cbs) { - each(cbs, call); - }; - var call = function (cb) { - data.each(function (x) { - setTimeout(function () { - cb(x); - }, 0); - }); - }; - baseFn(set); - return { - get: get, - map: map, - isReady: isReady - }; - }; - var pure = function (a) { - return nu$a(function (callback) { - callback(a); - }); - }; - var LazyValue = { - nu: nu$a, - pure: pure - }; - - var errorReporter = function (err) { - setTimeout(function () { - throw err; - }, 0); - }; - var make$3 = function (run) { - var get = function (callback) { - run().then(callback, errorReporter); - }; - var map = function (fab) { - return make$3(function () { - return run().then(fab); - }); - }; - var bind = function (aFutureB) { - return make$3(function () { - return run().then(function (v) { - return aFutureB(v).toPromise(); - }); - }); - }; - var anonBind = function (futureB) { - return make$3(function () { - return run().then(function () { - return futureB.toPromise(); - }); - }); - }; - var toLazy = function () { - return LazyValue.nu(get); - }; - var toCached = function () { - var cache = null; - return make$3(function () { - if (cache === null) { - cache = run(); - } - return cache; - }); - }; - var toPromise = run; - return { - map: map, - bind: bind, - anonBind: anonBind, - toLazy: toLazy, - toCached: toCached, - toPromise: toPromise, - get: get - }; - }; - var nu$b = function (baseFn) { - return make$3(function () { - return new Promise(baseFn); - }); - }; - var pure$1 = function (a) { - return make$3(function () { - return Promise.resolve(a); - }); - }; - var Future = { - nu: nu$b, - pure: pure$1 - }; - - var ariaElements = [ - 'input', - 'textarea' - ]; - var isAriaElement = function (elem) { - var name$1 = name(elem); - return contains(ariaElements, name$1); - }; - var markValid = function (component, invalidConfig) { - var elem = invalidConfig.getRoot(component).getOr(component.element); - remove$4(elem, invalidConfig.invalidClass); - invalidConfig.notify.each(function (notifyInfo) { - if (isAriaElement(component.element)) { - set$1(component.element, 'aria-invalid', false); - } - notifyInfo.getContainer(component).each(function (container) { - set(container, notifyInfo.validHtml); - }); - notifyInfo.onValid(component); - }); - }; - var markInvalid = function (component, invalidConfig, invalidState, text) { - var elem = invalidConfig.getRoot(component).getOr(component.element); - add$2(elem, invalidConfig.invalidClass); - invalidConfig.notify.each(function (notifyInfo) { - if (isAriaElement(component.element)) { - set$1(component.element, 'aria-invalid', true); - } - notifyInfo.getContainer(component).each(function (container) { - set(container, text); - }); - notifyInfo.onInvalid(component, text); - }); - }; - var query = function (component, invalidConfig, _invalidState) { - return invalidConfig.validator.fold(function () { - return Future.pure(Result.value(true)); - }, function (validatorInfo) { - return validatorInfo.validate(component); - }); - }; - var run$1 = function (component, invalidConfig, invalidState) { - invalidConfig.notify.each(function (notifyInfo) { - notifyInfo.onValidate(component); - }); - return query(component, invalidConfig).map(function (valid) { - if (component.getSystem().isConnected()) { - return valid.fold(function (err) { - markInvalid(component, invalidConfig, invalidState, err); - return Result.error(err); - }, function (v) { - markValid(component, invalidConfig); - return Result.value(v); - }); - } else { - return Result.error('No longer in system'); - } - }); - }; - var isInvalid = function (component, invalidConfig) { - var elem = invalidConfig.getRoot(component).getOr(component.element); - return has$2(elem, invalidConfig.invalidClass); - }; - - var InvalidateApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - markValid: markValid, - markInvalid: markInvalid, - query: query, - run: run$1, - isInvalid: isInvalid - }); - - var events$a = function (invalidConfig, invalidState) { - return invalidConfig.validator.map(function (validatorInfo) { - return derive([run(validatorInfo.onEvent, function (component) { - run$1(component, invalidConfig, invalidState).get(identity); - })].concat(validatorInfo.validateOnLoad ? [runOnAttached(function (component) { - run$1(component, invalidConfig, invalidState).get(noop); - })] : [])); - }).getOr({}); - }; - - var ActiveInvalidate = /*#__PURE__*/Object.freeze({ - __proto__: null, - events: events$a - }); - - var InvalidateSchema = [ - strict$1('invalidClass'), - defaulted$1('getRoot', Optional.none), - optionObjOf('notify', [ - defaulted$1('aria', 'alert'), - defaulted$1('getContainer', Optional.none), - defaulted$1('validHtml', ''), - onHandler('onValid'), - onHandler('onInvalid'), - onHandler('onValidate') - ]), - optionObjOf('validator', [ - strict$1('validate'), - defaulted$1('onEvent', 'input'), - defaulted$1('validateOnLoad', true) - ]) - ]; - - var Invalidating = create$1({ - fields: InvalidateSchema, - name: 'invalidating', - active: ActiveInvalidate, - apis: InvalidateApis, - extra: { - validation: function (validator) { - return function (component) { - var v = Representing.getValue(component); - return Future.pure(validator(v)); - }; - } - } - }); - - var getCoupled = function (component, coupleConfig, coupleState, name) { - return coupleState.getOrCreate(component, coupleConfig, name); - }; - - var CouplingApis = /*#__PURE__*/Object.freeze({ - __proto__: null, - getCoupled: getCoupled - }); - - var CouplingSchema = [strictOf('others', setOf$1(Result.value, anyValue$1()))]; - - var init$5 = function () { - var coupled = {}; - var getOrCreate = function (component, coupleConfig, name) { - var available = keys(coupleConfig.others); - if (!available) { - throw new Error('Cannot find coupled component: ' + name + '. Known coupled components: ' + JSON.stringify(available, null, 2)); - } else { - return get$1(coupled, name).getOrThunk(function () { - var builder = get$1(coupleConfig.others, name).getOrDie('No information found for coupled component: ' + name); - var spec = builder(component); - var built = component.getSystem().build(spec); - coupled[name] = built; - return built; - }); - } - }; - var readState = constant({}); - return nu$5({ - readState: readState, - getOrCreate: getOrCreate - }); - }; - - var CouplingState = /*#__PURE__*/Object.freeze({ - __proto__: null, - init: init$5 - }); - - var Coupling = create$1({ - fields: CouplingSchema, - name: 'coupling', - apis: CouplingApis, - state: CouplingState - }); - - var suffix = constant('sink'); - var partType = constant(optional({ - name: suffix(), - overrides: constant({ - dom: { tag: 'div' }, - behaviours: derive$1([Positioning.config({ useFixed: always })]), - events: derive([ - cutter(keydown()), - cutter(mousedown()), - cutter(click()) - ]) - }) - })); - - var HighlightOnOpen; - (function (HighlightOnOpen) { - HighlightOnOpen[HighlightOnOpen['HighlightFirst'] = 0] = 'HighlightFirst'; - HighlightOnOpen[HighlightOnOpen['HighlightNone'] = 1] = 'HighlightNone'; - }(HighlightOnOpen || (HighlightOnOpen = {}))); - var getAnchor = function (detail, component) { - var hotspot = detail.getHotspot(component).getOr(component); - var anchor = 'hotspot'; - var overrides = detail.getAnchorOverrides(); - return detail.layouts.fold(function () { - return { - anchor: anchor, - hotspot: hotspot, - overrides: overrides - }; - }, function (layouts) { - return { - anchor: anchor, - hotspot: hotspot, - overrides: overrides, - layouts: layouts - }; - }); - }; - var fetch = function (detail, mapFetch, component) { - var fetcher = detail.fetch; - return fetcher(component).map(mapFetch); - }; - var openF = function (detail, mapFetch, anchor, component, sandbox, externals, highlightOnOpen) { - var futureData = fetch(detail, mapFetch, component); - var getLazySink = getSink(component, detail); - return futureData.map(function (tdata) { - return tdata.bind(function (data) { - return Optional.from(tieredMenu.sketch(__assign(__assign({}, externals.menu()), { - uid: generate$2(''), - data: data, - highlightImmediately: highlightOnOpen === HighlightOnOpen.HighlightFirst, - onOpenMenu: function (tmenu, menu) { - var sink = getLazySink().getOrDie(); - Positioning.position(sink, anchor, menu); - Sandboxing.decloak(sandbox); - }, - onOpenSubmenu: function (tmenu, item, submenu) { - var sink = getLazySink().getOrDie(); - Positioning.position(sink, { - anchor: 'submenu', - item: item - }, submenu); - Sandboxing.decloak(sandbox); - }, - onRepositionMenu: function (tmenu, primaryMenu, submenuTriggers) { - var sink = getLazySink().getOrDie(); - Positioning.position(sink, anchor, primaryMenu); - each(submenuTriggers, function (st) { - Positioning.position(sink, { - anchor: 'submenu', - item: st.triggeringItem - }, st.triggeredMenu); - }); - }, - onEscape: function () { - Focusing.focus(component); - Sandboxing.close(sandbox); - return Optional.some(true); - } - }))); - }); - }); - }; - var open$1 = function (detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen) { - var anchor = getAnchor(detail, hotspot); - var processed = openF(detail, mapFetch, anchor, hotspot, sandbox, externals, highlightOnOpen); - return processed.map(function (tdata) { - tdata.fold(function () { - if (Sandboxing.isOpen(sandbox)) { - Sandboxing.close(sandbox); - } - }, function (data) { - Sandboxing.cloak(sandbox); - Sandboxing.open(sandbox, data); - onOpenSync(sandbox); - }); - return sandbox; - }); - }; - var close$1 = function (detail, mapFetch, component, sandbox, _externals, _onOpenSync, _highlightOnOpen) { - Sandboxing.close(sandbox); - return Future.pure(sandbox); - }; - var togglePopup = function (detail, mapFetch, hotspot, externals, onOpenSync, highlightOnOpen) { - var sandbox = Coupling.getCoupled(hotspot, 'sandbox'); - var showing = Sandboxing.isOpen(sandbox); - var action = showing ? close$1 : open$1; - return action(detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen); - }; - var matchWidth = function (hotspot, container, useMinWidth) { - var menu = Composing.getCurrent(container).getOr(container); - var buttonWidth = get$8(hotspot.element); - if (useMinWidth) { - set$2(menu.element, 'min-width', buttonWidth + 'px'); - } else { - set$4(menu.element, buttonWidth); - } - }; - var getSink = function (anyInSystem, sinkDetail) { - return anyInSystem.getSystem().getByUid(sinkDetail.uid + '-' + suffix()).map(function (internalSink) { - return function () { - return Result.value(internalSink); - }; - }).getOrThunk(function () { - return sinkDetail.lazySink.fold(function () { - return function () { - return Result.error(new Error('No internal sink is specified, nor could an external sink be found')); - }; - }, function (lazySinkFn) { - return function () { - return lazySinkFn(anyInSystem); - }; - }); - }); - }; - var doRepositionMenus = function (sandbox) { - Sandboxing.getState(sandbox).each(function (tmenu) { - tieredMenu.repositionMenus(tmenu); - }); - }; - var makeSandbox = function (detail, hotspot, extras) { - var ariaOwner = manager(); - var onOpen = function (component, menu) { - var anchor = getAnchor(detail, hotspot); - ariaOwner.link(hotspot.element); - if (detail.matchWidth) { - matchWidth(anchor.hotspot, menu, detail.useMinWidth); - } - detail.onOpen(anchor, component, menu); - if (extras !== undefined && extras.onOpen !== undefined) { - extras.onOpen(component, menu); - } - }; - var onClose = function (component, menu) { - ariaOwner.unlink(hotspot.element); - if (extras !== undefined && extras.onClose !== undefined) { - extras.onClose(component, menu); - } - }; - var lazySink = getSink(hotspot, detail); - return { - dom: { - tag: 'div', - classes: detail.sandboxClasses, - attributes: { - id: ariaOwner.id, - role: 'listbox' - } - }, - behaviours: SketchBehaviours.augment(detail.sandboxBehaviours, [ - Representing.config({ - store: { - mode: 'memory', - initialValue: hotspot - } - }), - Sandboxing.config({ - onOpen: onOpen, - onClose: onClose, - isPartOf: function (container, data, queryElem) { - return isPartOf(data, queryElem) || isPartOf(hotspot, queryElem); - }, - getAttachPoint: function () { - return lazySink().getOrDie(); - } - }), - Composing.config({ - find: function (sandbox) { - return Sandboxing.getState(sandbox).bind(function (menu) { - return Composing.getCurrent(menu); - }); - } - }), - Receiving.config({ channels: __assign(__assign({}, receivingChannel({ isExtraPart: never })), receivingChannel$1({ doReposition: doRepositionMenus })) }) - ]) - }; - }; - var repositionMenus = function (comp) { - var sandbox = Coupling.getCoupled(comp, 'sandbox'); - doRepositionMenus(sandbox); - }; - - var sandboxFields = function () { - return [ - defaulted$1('sandboxClasses', []), - SketchBehaviours.field('sandboxBehaviours', [ - Composing, - Receiving, - Sandboxing, - Representing - ]) - ]; - }; - - var schema$g = constant([ - strict$1('dom'), - strict$1('fetch'), - onHandler('onOpen'), - onKeyboardHandler('onExecute'), - defaulted$1('getHotspot', Optional.some), - defaulted$1('getAnchorOverrides', constant({})), - schema$1(), - field$1('dropdownBehaviours', [ - Toggling, - Coupling, - Keying, - Focusing - ]), - strict$1('toggleClass'), - defaulted$1('eventOrder', {}), - option('lazySink'), - defaulted$1('matchWidth', false), - defaulted$1('useMinWidth', false), - option('role') - ].concat(sandboxFields())); - var parts$4 = constant([ - external$1({ - schema: [tieredMenuMarkers()], - name: 'menu', - defaults: function (detail) { - return { onExecute: detail.onExecute }; - } - }), - partType() - ]); - - var factory$6 = function (detail, components, _spec, externals) { - var _a; - var lookupAttr = function (attr) { - return get$1(detail.dom, 'attributes').bind(function (attrs) { - return get$1(attrs, attr); - }); - }; - var switchToMenu = function (sandbox) { - Sandboxing.getState(sandbox).each(function (tmenu) { - tieredMenu.highlightPrimary(tmenu); - }); - }; - var action = function (component) { - var onOpenSync = switchToMenu; - togglePopup(detail, function (x) { - return x; - }, component, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop); - }; - var apis = { - expand: function (comp) { - if (!Toggling.isOn(comp)) { - togglePopup(detail, function (x) { - return x; - }, comp, externals, noop, HighlightOnOpen.HighlightNone).get(noop); - } - }, - open: function (comp) { - if (!Toggling.isOn(comp)) { - togglePopup(detail, function (x) { - return x; - }, comp, externals, noop, HighlightOnOpen.HighlightFirst).get(noop); - } - }, - isOpen: Toggling.isOn, - close: function (comp) { - if (Toggling.isOn(comp)) { - togglePopup(detail, function (x) { - return x; - }, comp, externals, noop, HighlightOnOpen.HighlightFirst).get(noop); - } - }, - repositionMenus: function (comp) { - if (Toggling.isOn(comp)) { - repositionMenus(comp); - } - } - }; - var triggerExecute = function (comp, _se) { - emitExecute(comp); - return Optional.some(true); - }; - return { - uid: detail.uid, - dom: detail.dom, - components: components, - behaviours: augment(detail.dropdownBehaviours, [ - Toggling.config({ - toggleClass: detail.toggleClass, - aria: { mode: 'expanded' } - }), - Coupling.config({ - others: { - sandbox: function (hotspot) { - return makeSandbox(detail, hotspot, { - onOpen: function () { - return Toggling.on(hotspot); - }, - onClose: function () { - return Toggling.off(hotspot); - } - }); - } - } - }), - Keying.config({ - mode: 'special', - onSpace: triggerExecute, - onEnter: triggerExecute, - onDown: function (comp, _se) { - if (Dropdown.isOpen(comp)) { - var sandbox = Coupling.getCoupled(comp, 'sandbox'); - switchToMenu(sandbox); - } else { - Dropdown.open(comp); - } - return Optional.some(true); - }, - onEscape: function (comp, _se) { - if (Dropdown.isOpen(comp)) { - Dropdown.close(comp); - return Optional.some(true); - } else { - return Optional.none(); - } - } - }), - Focusing.config({}) - ]), - events: events$7(Optional.some(action)), - eventOrder: __assign(__assign({}, detail.eventOrder), (_a = {}, _a[execute()] = [ - 'disabling', - 'toggling', - 'alloy.base.behaviour' - ], _a)), - apis: apis, - domModification: { - attributes: __assign(__assign({ 'aria-haspopup': 'true' }, detail.role.fold(function () { - return {}; - }, function (role) { - return { role: role }; - })), detail.dom.tag === 'button' ? { type: lookupAttr('type').getOr('button') } : {}) - } - }; - }; - var Dropdown = composite$1({ - name: 'Dropdown', - configFields: schema$g(), - partFields: parts$4(), - factory: factory$6, - apis: { - open: function (apis, comp) { - return apis.open(comp); - }, - expand: function (apis, comp) { - return apis.expand(comp); - }, - close: function (apis, comp) { - return apis.close(comp); - }, - isOpen: function (apis, comp) { - return apis.isOpen(comp); - }, - repositionMenus: function (apis, comp) { - return apis.repositionMenus(comp); - } - } - }); - - var exhibit$5 = function () { - return nu$6({ - styles: { - '-webkit-user-select': 'none', - 'user-select': 'none', - '-ms-user-select': 'none', - '-moz-user-select': '-moz-none' - }, - attributes: { unselectable: 'on' } - }); - }; - var events$b = function () { - return derive([abort(selectstart(), always)]); - }; - - var ActiveUnselecting = /*#__PURE__*/Object.freeze({ - __proto__: null, - events: events$b, - exhibit: exhibit$5 - }); - - var Unselecting = create$1({ - fields: [], - name: 'unselecting', - active: ActiveUnselecting - }); - - var renderPanelButton = function (spec, sharedBackstage) { - return Dropdown.sketch({ - dom: spec.dom, - components: spec.components, - toggleClass: 'mce-active', - dropdownBehaviours: derive$1([ - DisablingConfigs.button(sharedBackstage.providers.isDisabled), - receivingConfig(), - Unselecting.config({}), - Tabstopping.config({}) - ]), - layouts: spec.layouts, - sandboxClasses: ['tox-dialog__popups'], - lazySink: sharedBackstage.getSink, - fetch: function (comp) { - return Future.nu(function (callback) { - return spec.fetch(callback); - }).map(function (items) { - return Optional.from(createTieredDataFrom(deepMerge(createPartialChoiceMenu(generate$1('menu-value'), items, function (value) { - spec.onItemAction(comp, value); - }, spec.columns, spec.presets, ItemResponse$1.CLOSE_ON_EXECUTE, never, sharedBackstage.providers), { movement: deriveMenuMovement(spec.columns, spec.presets) }))); - }); - }, - parts: { menu: part(false, 1, spec.presets) } - }); - }; - - var colorInputChangeEvent = generate$1('color-input-change'); - var colorSwatchChangeEvent = generate$1('color-swatch-change'); - var colorPickerCancelEvent = generate$1('color-picker-cancel'); - var renderColorInput = function (spec, sharedBackstage, colorInputBackstage) { - var pField = FormField.parts.field({ - factory: Input, - inputClasses: ['tox-textfield'], - onSetValue: function (c) { - return Invalidating.run(c).get(noop); - }, - inputBehaviours: derive$1([ - Disabling.config({ disabled: sharedBackstage.providers.isDisabled }), - receivingConfig(), - Tabstopping.config({}), - Invalidating.config({ - invalidClass: 'tox-textbox-field-invalid', - getRoot: function (comp) { - return parent(comp.element); - }, - notify: { - onValid: function (comp) { - var val = Representing.getValue(comp); - emitWith(comp, colorInputChangeEvent, { color: val }); - } - }, - validator: { - validateOnLoad: false, - validate: function (input) { - var inputValue = Representing.getValue(input); - if (inputValue.length === 0) { - return Future.pure(Result.value(true)); - } else { - var span = SugarElement.fromTag('span'); - set$2(span, 'background-color', inputValue); - var res = getRaw(span, 'background-color').fold(function () { - return Result.error('blah'); - }, function (_) { - return Result.value(inputValue); - }); - return Future.pure(res); - } - } - } - }) - ]), - selectOnFocus: false - }); - var pLabel = spec.label.map(function (label) { - return renderLabel(label, sharedBackstage.providers); - }); - var emitSwatchChange = function (colorBit, value) { - emitWith(colorBit, colorSwatchChangeEvent, { value: value }); - }; - var onItemAction = function (comp, value) { - memColorButton.getOpt(comp).each(function (colorBit) { - if (value === 'custom') { - colorInputBackstage.colorPicker(function (valueOpt) { - valueOpt.fold(function () { - return emit(colorBit, colorPickerCancelEvent); - }, function (value) { - emitSwatchChange(colorBit, value); - addColor(value); - }); - }, '#ffffff'); - } else if (value === 'remove') { - emitSwatchChange(colorBit, ''); - } else { - emitSwatchChange(colorBit, value); - } - }); - }; - var memColorButton = record(renderPanelButton({ - dom: { - tag: 'span', - attributes: { 'aria-label': sharedBackstage.providers.translate('Color swatch') } - }, - layouts: { - onRtl: function () { - return [ - southwest$1, - southeast$1, - south$1 - ]; - }, - onLtr: function () { - return [ - southeast$1, - southwest$1, - south$1 - ]; - } - }, - components: [], - fetch: getFetch(colorInputBackstage.getColors(), colorInputBackstage.hasCustomColors()), - columns: colorInputBackstage.getColorCols(), - presets: 'color', - onItemAction: onItemAction - }, sharedBackstage)); - return FormField.sketch({ - dom: { - tag: 'div', - classes: ['tox-form__group'] - }, - components: pLabel.toArray().concat([{ - dom: { - tag: 'div', - classes: ['tox-color-input'] - }, - components: [ - pField, - memColorButton.asSpec() - ] - }]), - fieldBehaviours: derive$1([config('form-field-events', [ - run(colorInputChangeEvent, function (comp, se) { - memColorButton.getOpt(comp).each(function (colorButton) { - set$2(colorButton.element, 'background-color', se.event.color); - }); - emitWith(comp, formChangeEvent, { name: spec.name }); - }), - run(colorSwatchChangeEvent, function (comp, se) { - FormField.getField(comp).each(function (field) { - Representing.setValue(field, se.event.value); - Composing.getCurrent(comp).each(Focusing.focus); - }); - }), - run(colorPickerCancelEvent, function (comp, _se) { - FormField.getField(comp).each(function (_field) { - Composing.getCurrent(comp).each(Focusing.focus); - }); - }) - ])]) - }); - }; - - var labelPart = optional({ - schema: [strict$1('dom')], - name: 'label' - }); - var edgePart = function (name) { - return optional({ - name: '' + name + '-edge', - overrides: function (detail) { - var action = detail.model.manager.edgeActions[name]; - return action.fold(function () { - return {}; - }, function (a) { - return { - events: derive([ - runActionExtra(touchstart(), function (comp, se, d) { - return a(comp, d); - }, [detail]), - runActionExtra(mousedown(), function (comp, se, d) { - return a(comp, d); - }, [detail]), - runActionExtra(mousemove(), function (comp, se, det) { - if (det.mouseIsDown.get()) { - a(comp, det); - } - }, [detail]) - ]) - }; - }); - } - }); - }; - var tlEdgePart = edgePart('top-left'); - var tedgePart = edgePart('top'); - var trEdgePart = edgePart('top-right'); - var redgePart = edgePart('right'); - var brEdgePart = edgePart('bottom-right'); - var bedgePart = edgePart('bottom'); - var blEdgePart = edgePart('bottom-left'); - var ledgePart = edgePart('left'); - var thumbPart = required({ - name: 'thumb', - defaults: constant({ dom: { styles: { position: 'absolute' } } }), - overrides: function (detail) { - return { - events: derive([ - redirectToPart(touchstart(), detail, 'spectrum'), - redirectToPart(touchmove(), detail, 'spectrum'), - redirectToPart(touchend(), detail, 'spectrum'), - redirectToPart(mousedown(), detail, 'spectrum'), - redirectToPart(mousemove(), detail, 'spectrum'), - redirectToPart(mouseup(), detail, 'spectrum') - ]) - }; - } - }); - var spectrumPart = required({ - schema: [state$1('mouseIsDown', function () { - return Cell(false); - })], - name: 'spectrum', - overrides: function (detail) { - var modelDetail = detail.model; - var model = modelDetail.manager; - var setValueFrom = function (component, simulatedEvent) { - return model.getValueFromEvent(simulatedEvent).map(function (value) { - return model.setValueFrom(component, detail, value); - }); - }; - return { - behaviours: derive$1([ - Keying.config({ - mode: 'special', - onLeft: function (spectrum) { - return model.onLeft(spectrum, detail); - }, - onRight: function (spectrum) { - return model.onRight(spectrum, detail); - }, - onUp: function (spectrum) { - return model.onUp(spectrum, detail); - }, - onDown: function (spectrum) { - return model.onDown(spectrum, detail); - } - }), - Focusing.config({}) - ]), - events: derive([ - run(touchstart(), setValueFrom), - run(touchmove(), setValueFrom), - run(mousedown(), setValueFrom), - run(mousemove(), function (spectrum, se) { - if (detail.mouseIsDown.get()) { - setValueFrom(spectrum, se); - } - }) - ]) - }; - } - }); - var SliderParts = [ - labelPart, - ledgePart, - redgePart, - tedgePart, - bedgePart, - tlEdgePart, - trEdgePart, - blEdgePart, - brEdgePart, - thumbPart, - spectrumPart - ]; - - var _sliderChangeEvent = 'slider.change.value'; - var sliderChangeEvent = constant(_sliderChangeEvent); - var isTouchEvent = function (evt) { - return evt.type.indexOf('touch') !== -1; - }; - var getEventSource = function (simulatedEvent) { - var evt = simulatedEvent.event.raw; - if (isTouchEvent(evt)) { - var touchEvent = evt; - return touchEvent.touches !== undefined && touchEvent.touches.length === 1 ? Optional.some(touchEvent.touches[0]).map(function (t) { - return SugarPosition(t.clientX, t.clientY); - }) : Optional.none(); - } else { - var mouseEvent = evt; - return mouseEvent.clientX !== undefined ? Optional.some(mouseEvent).map(function (me) { - return SugarPosition(me.clientX, me.clientY); - }) : Optional.none(); - } - }; - - var t = 'top', r$1 = 'right', b = 'bottom', l = 'left'; - var minX = function (detail) { - return detail.model.minX; - }; - var minY = function (detail) { - return detail.model.minY; - }; - var min1X = function (detail) { - return detail.model.minX - 1; - }; - var min1Y = function (detail) { - return detail.model.minY - 1; - }; - var maxX = function (detail) { - return detail.model.maxX; - }; - var maxY = function (detail) { - return detail.model.maxY; - }; - var max1X = function (detail) { - return detail.model.maxX + 1; - }; - var max1Y = function (detail) { - return detail.model.maxY + 1; - }; - var range$2 = function (detail, max, min) { - return max(detail) - min(detail); - }; - var xRange = function (detail) { - return range$2(detail, maxX, minX); - }; - var yRange = function (detail) { - return range$2(detail, maxY, minY); - }; - var halfX = function (detail) { - return xRange(detail) / 2; - }; - var halfY = function (detail) { - return yRange(detail) / 2; - }; - var step = function (detail) { - return detail.stepSize; - }; - var snap = function (detail) { - return detail.snapToGrid; - }; - var snapStart = function (detail) { - return detail.snapStart; - }; - var rounded = function (detail) { - return detail.rounded; - }; - var hasEdge = function (detail, edgeName) { - return detail[edgeName + '-edge'] !== undefined; - }; - var hasLEdge = function (detail) { - return hasEdge(detail, l); - }; - var hasREdge = function (detail) { - return hasEdge(detail, r$1); - }; - var hasTEdge = function (detail) { - return hasEdge(detail, t); - }; - var hasBEdge = function (detail) { - return hasEdge(detail, b); - }; - var currentValue = function (detail) { - return detail.model.value.get(); - }; - - var xValue = function (x) { - return { x: x }; - }; - var yValue = function (y) { - return { y: y }; - }; - var xyValue = function (x, y) { - return { - x: x, - y: y - }; - }; - var fireSliderChange = function (component, value) { - emitWith(component, sliderChangeEvent(), { value: value }); - }; - var setToTLEdgeXY = function (edge, detail) { - fireSliderChange(edge, xyValue(min1X(detail), min1Y(detail))); - }; - var setToTEdge = function (edge, detail) { - fireSliderChange(edge, yValue(min1Y(detail))); - }; - var setToTEdgeXY = function (edge, detail) { - fireSliderChange(edge, xyValue(halfX(detail), min1Y(detail))); - }; - var setToTREdgeXY = function (edge, detail) { - fireSliderChange(edge, xyValue(max1X(detail), min1Y(detail))); - }; - var setToREdge = function (edge, detail) { - fireSliderChange(edge, xValue(max1X(detail))); - }; - var setToREdgeXY = function (edge, detail) { - fireSliderChange(edge, xyValue(max1X(detail), halfY(detail))); - }; - var setToBREdgeXY = function (edge, detail) { - fireSliderChange(edge, xyValue(max1X(detail), max1Y(detail))); - }; - var setToBEdge = function (edge, detail) { - fireSliderChange(edge, yValue(max1Y(detail))); - }; - var setToBEdgeXY = function (edge, detail) { - fireSliderChange(edge, xyValue(halfX(detail), max1Y(detail))); - }; - var setToBLEdgeXY = function (edge, detail) { - fireSliderChange(edge, xyValue(min1X(detail), max1Y(detail))); - }; - var setToLEdge = function (edge, detail) { - fireSliderChange(edge, xValue(min1X(detail))); - }; - var setToLEdgeXY = function (edge, detail) { - fireSliderChange(edge, xyValue(min1X(detail), halfY(detail))); - }; - - var reduceBy = function (value, min, max, step) { - if (value < min) { - return value; - } else if (value > max) { - return max; - } else if (value === min) { - return min - 1; - } else { - return Math.max(min, value - step); - } - }; - var increaseBy = function (value, min, max, step) { - if (value > max) { - return value; - } else if (value < min) { - return min; - } else if (value === max) { - return max + 1; - } else { - return Math.min(max, value + step); - } - }; - var capValue = function (value, min, max) { - return Math.max(min, Math.min(max, value)); - }; - var snapValueOf = function (value, min, max, step, snapStart) { - return snapStart.fold(function () { - var initValue = value - min; - var extraValue = Math.round(initValue / step) * step; - return capValue(min + extraValue, min - 1, max + 1); - }, function (start) { - var remainder = (value - start) % step; - var adjustment = Math.round(remainder / step); - var rawSteps = Math.floor((value - start) / step); - var maxSteps = Math.floor((max - start) / step); - var numSteps = Math.min(maxSteps, rawSteps + adjustment); - var r = start + numSteps * step; - return Math.max(start, r); - }); - }; - var findOffsetOf = function (value, min, max) { - return Math.min(max, Math.max(value, min)) - min; - }; - var findValueOf = function (args) { - var min = args.min, max = args.max, range = args.range, value = args.value, step = args.step, snap = args.snap, snapStart = args.snapStart, rounded = args.rounded, hasMinEdge = args.hasMinEdge, hasMaxEdge = args.hasMaxEdge, minBound = args.minBound, maxBound = args.maxBound, screenRange = args.screenRange; - var capMin = hasMinEdge ? min - 1 : min; - var capMax = hasMaxEdge ? max + 1 : max; - if (value < minBound) { - return capMin; - } else if (value > maxBound) { - return capMax; - } else { - var offset = findOffsetOf(value, minBound, maxBound); - var newValue = capValue(offset / screenRange * range + min, capMin, capMax); - if (snap && newValue >= min && newValue <= max) { - return snapValueOf(newValue, min, max, step, snapStart); - } else if (rounded) { - return Math.round(newValue); - } else { - return newValue; - } - } - }; - var findOffsetOfValue = function (args) { - var min = args.min, max = args.max, range = args.range, value = args.value, hasMinEdge = args.hasMinEdge, hasMaxEdge = args.hasMaxEdge, maxBound = args.maxBound, maxOffset = args.maxOffset, centerMinEdge = args.centerMinEdge, centerMaxEdge = args.centerMaxEdge; - if (value < min) { - return hasMinEdge ? 0 : centerMinEdge; - } else if (value > max) { - return hasMaxEdge ? maxBound : centerMaxEdge; - } else { - return (value - min) / range * maxOffset; - } - }; - - var top = 'top', right = 'right', bottom = 'bottom', left = 'left', width = 'width', height = 'height'; - var getBounds$1 = function (component) { - return component.element.dom.getBoundingClientRect(); - }; - var getBoundsProperty = function (bounds, property) { - return bounds[property]; - }; - var getMinXBounds = function (component) { - var bounds = getBounds$1(component); - return getBoundsProperty(bounds, left); - }; - var getMaxXBounds = function (component) { - var bounds = getBounds$1(component); - return getBoundsProperty(bounds, right); - }; - var getMinYBounds = function (component) { - var bounds = getBounds$1(component); - return getBoundsProperty(bounds, top); - }; - var getMaxYBounds = function (component) { - var bounds = getBounds$1(component); - return getBoundsProperty(bounds, bottom); - }; - var getXScreenRange = function (component) { - var bounds = getBounds$1(component); - return getBoundsProperty(bounds, width); - }; - var getYScreenRange = function (component) { - var bounds = getBounds$1(component); - return getBoundsProperty(bounds, height); - }; - var getCenterOffsetOf = function (componentMinEdge, componentMaxEdge, spectrumMinEdge) { - return (componentMinEdge + componentMaxEdge) / 2 - spectrumMinEdge; - }; - var getXCenterOffSetOf = function (component, spectrum) { - var componentBounds = getBounds$1(component); - var spectrumBounds = getBounds$1(spectrum); - var componentMinEdge = getBoundsProperty(componentBounds, left); - var componentMaxEdge = getBoundsProperty(componentBounds, right); - var spectrumMinEdge = getBoundsProperty(spectrumBounds, left); - return getCenterOffsetOf(componentMinEdge, componentMaxEdge, spectrumMinEdge); - }; - var getYCenterOffSetOf = function (component, spectrum) { - var componentBounds = getBounds$1(component); - var spectrumBounds = getBounds$1(spectrum); - var componentMinEdge = getBoundsProperty(componentBounds, top); - var componentMaxEdge = getBoundsProperty(componentBounds, bottom); - var spectrumMinEdge = getBoundsProperty(spectrumBounds, top); - return getCenterOffsetOf(componentMinEdge, componentMaxEdge, spectrumMinEdge); - }; - - var fireSliderChange$1 = function (spectrum, value) { - emitWith(spectrum, sliderChangeEvent(), { value: value }); - }; - var sliderValue = function (x) { - return { x: x }; - }; - var findValueOfOffset = function (spectrum, detail, left) { - var args = { - min: minX(detail), - max: maxX(detail), - range: xRange(detail), - value: left, - step: step(detail), - snap: snap(detail), - snapStart: snapStart(detail), - rounded: rounded(detail), - hasMinEdge: hasLEdge(detail), - hasMaxEdge: hasREdge(detail), - minBound: getMinXBounds(spectrum), - maxBound: getMaxXBounds(spectrum), - screenRange: getXScreenRange(spectrum) - }; - return findValueOf(args); - }; - var setValueFrom = function (spectrum, detail, value) { - var xValue = findValueOfOffset(spectrum, detail, value); - var sliderVal = sliderValue(xValue); - fireSliderChange$1(spectrum, sliderVal); - return xValue; - }; - var setToMin = function (spectrum, detail) { - var min = minX(detail); - fireSliderChange$1(spectrum, sliderValue(min)); - }; - var setToMax = function (spectrum, detail) { - var max = maxX(detail); - fireSliderChange$1(spectrum, sliderValue(max)); - }; - var moveBy = function (direction, spectrum, detail) { - var f = direction > 0 ? increaseBy : reduceBy; - var xValue = f(currentValue(detail).x, minX(detail), maxX(detail), step(detail)); - fireSliderChange$1(spectrum, sliderValue(xValue)); - return Optional.some(xValue); - }; - var handleMovement = function (direction) { - return function (spectrum, detail) { - return moveBy(direction, spectrum, detail).map(always); - }; - }; - var getValueFromEvent = function (simulatedEvent) { - var pos = getEventSource(simulatedEvent); - return pos.map(function (p) { - return p.left; - }); - }; - var findOffsetOfValue$1 = function (spectrum, detail, value, minEdge, maxEdge) { - var minOffset = 0; - var maxOffset = getXScreenRange(spectrum); - var centerMinEdge = minEdge.bind(function (edge) { - return Optional.some(getXCenterOffSetOf(edge, spectrum)); - }).getOr(minOffset); - var centerMaxEdge = maxEdge.bind(function (edge) { - return Optional.some(getXCenterOffSetOf(edge, spectrum)); - }).getOr(maxOffset); - var args = { - min: minX(detail), - max: maxX(detail), - range: xRange(detail), - value: value, - hasMinEdge: hasLEdge(detail), - hasMaxEdge: hasREdge(detail), - minBound: getMinXBounds(spectrum), - minOffset: minOffset, - maxBound: getMaxXBounds(spectrum), - maxOffset: maxOffset, - centerMinEdge: centerMinEdge, - centerMaxEdge: centerMaxEdge - }; - return findOffsetOfValue(args); - }; - var findPositionOfValue = function (slider, spectrum, value, minEdge, maxEdge, detail) { - var offset = findOffsetOfValue$1(spectrum, detail, value, minEdge, maxEdge); - return getMinXBounds(spectrum) - getMinXBounds(slider) + offset; - }; - var setPositionFromValue = function (slider, thumb, detail, edges) { - var value = currentValue(detail); - var pos = findPositionOfValue(slider, edges.getSpectrum(slider), value.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail); - var thumbRadius = get$8(thumb.element) / 2; - set$2(thumb.element, 'left', pos - thumbRadius + 'px'); - }; - var onLeft = handleMovement(-1); - var onRight = handleMovement(1); - var onUp = Optional.none; - var onDown = Optional.none; - var edgeActions = { - 'top-left': Optional.none(), - 'top': Optional.none(), - 'top-right': Optional.none(), - 'right': Optional.some(setToREdge), - 'bottom-right': Optional.none(), - 'bottom': Optional.none(), - 'bottom-left': Optional.none(), - 'left': Optional.some(setToLEdge) - }; - - var HorizontalModel = /*#__PURE__*/Object.freeze({ - __proto__: null, - setValueFrom: setValueFrom, - setToMin: setToMin, - setToMax: setToMax, - findValueOfOffset: findValueOfOffset, - getValueFromEvent: getValueFromEvent, - findPositionOfValue: findPositionOfValue, - setPositionFromValue: setPositionFromValue, - onLeft: onLeft, - onRight: onRight, - onUp: onUp, - onDown: onDown, - edgeActions: edgeActions - }); - - var fireSliderChange$2 = function (spectrum, value) { - emitWith(spectrum, sliderChangeEvent(), { value: value }); - }; - var sliderValue$1 = function (y) { - return { y: y }; - }; - var findValueOfOffset$1 = function (spectrum, detail, top) { - var args = { - min: minY(detail), - max: maxY(detail), - range: yRange(detail), - value: top, - step: step(detail), - snap: snap(detail), - snapStart: snapStart(detail), - rounded: rounded(detail), - hasMinEdge: hasTEdge(detail), - hasMaxEdge: hasBEdge(detail), - minBound: getMinYBounds(spectrum), - maxBound: getMaxYBounds(spectrum), - screenRange: getYScreenRange(spectrum) - }; - return findValueOf(args); - }; - var setValueFrom$1 = function (spectrum, detail, value) { - var yValue = findValueOfOffset$1(spectrum, detail, value); - var sliderVal = sliderValue$1(yValue); - fireSliderChange$2(spectrum, sliderVal); - return yValue; - }; - var setToMin$1 = function (spectrum, detail) { - var min = minY(detail); - fireSliderChange$2(spectrum, sliderValue$1(min)); - }; - var setToMax$1 = function (spectrum, detail) { - var max = maxY(detail); - fireSliderChange$2(spectrum, sliderValue$1(max)); - }; - var moveBy$1 = function (direction, spectrum, detail) { - var f = direction > 0 ? increaseBy : reduceBy; - var yValue = f(currentValue(detail).y, minY(detail), maxY(detail), step(detail)); - fireSliderChange$2(spectrum, sliderValue$1(yValue)); - return Optional.some(yValue); - }; - var handleMovement$1 = function (direction) { - return function (spectrum, detail) { - return moveBy$1(direction, spectrum, detail).map(always); - }; - }; - var getValueFromEvent$1 = function (simulatedEvent) { - var pos = getEventSource(simulatedEvent); - return pos.map(function (p) { - return p.top; - }); - }; - var findOffsetOfValue$2 = function (spectrum, detail, value, minEdge, maxEdge) { - var minOffset = 0; - var maxOffset = getYScreenRange(spectrum); - var centerMinEdge = minEdge.bind(function (edge) { - return Optional.some(getYCenterOffSetOf(edge, spectrum)); - }).getOr(minOffset); - var centerMaxEdge = maxEdge.bind(function (edge) { - return Optional.some(getYCenterOffSetOf(edge, spectrum)); - }).getOr(maxOffset); - var args = { - min: minY(detail), - max: maxY(detail), - range: yRange(detail), - value: value, - hasMinEdge: hasTEdge(detail), - hasMaxEdge: hasBEdge(detail), - minBound: getMinYBounds(spectrum), - minOffset: minOffset, - maxBound: getMaxYBounds(spectrum), - maxOffset: maxOffset, - centerMinEdge: centerMinEdge, - centerMaxEdge: centerMaxEdge - }; - return findOffsetOfValue(args); - }; - var findPositionOfValue$1 = function (slider, spectrum, value, minEdge, maxEdge, detail) { - var offset = findOffsetOfValue$2(spectrum, detail, value, minEdge, maxEdge); - return getMinYBounds(spectrum) - getMinYBounds(slider) + offset; - }; - var setPositionFromValue$1 = function (slider, thumb, detail, edges) { - var value = currentValue(detail); - var pos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail); - var thumbRadius = get$7(thumb.element) / 2; - set$2(thumb.element, 'top', pos - thumbRadius + 'px'); - }; - var onLeft$1 = Optional.none; - var onRight$1 = Optional.none; - var onUp$1 = handleMovement$1(-1); - var onDown$1 = handleMovement$1(1); - var edgeActions$1 = { - 'top-left': Optional.none(), - 'top': Optional.some(setToTEdge), - 'top-right': Optional.none(), - 'right': Optional.none(), - 'bottom-right': Optional.none(), - 'bottom': Optional.some(setToBEdge), - 'bottom-left': Optional.none(), - 'left': Optional.none() - }; - - var VerticalModel = /*#__PURE__*/Object.freeze({ - __proto__: null, - setValueFrom: setValueFrom$1, - setToMin: setToMin$1, - setToMax: setToMax$1, - findValueOfOffset: findValueOfOffset$1, - getValueFromEvent: getValueFromEvent$1, - findPositionOfValue: findPositionOfValue$1, - setPositionFromValue: setPositionFromValue$1, - onLeft: onLeft$1, - onRight: onRight$1, - onUp: onUp$1, - onDown: onDown$1, - edgeActions: edgeActions$1 - }); - - var fireSliderChange$3 = function (spectrum, value) { - emitWith(spectrum, sliderChangeEvent(), { value: value }); - }; - var sliderValue$2 = function (x, y) { - return { - x: x, - y: y - }; - }; - var setValueFrom$2 = function (spectrum, detail, value) { - var xValue = findValueOfOffset(spectrum, detail, value.left); - var yValue = findValueOfOffset$1(spectrum, detail, value.top); - var val = sliderValue$2(xValue, yValue); - fireSliderChange$3(spectrum, val); - return val; - }; - var moveBy$2 = function (direction, isVerticalMovement, spectrum, detail) { - var f = direction > 0 ? increaseBy : reduceBy; - var xValue = isVerticalMovement ? currentValue(detail).x : f(currentValue(detail).x, minX(detail), maxX(detail), step(detail)); - var yValue = !isVerticalMovement ? currentValue(detail).y : f(currentValue(detail).y, minY(detail), maxY(detail), step(detail)); - fireSliderChange$3(spectrum, sliderValue$2(xValue, yValue)); - return Optional.some(xValue); - }; - var handleMovement$2 = function (direction, isVerticalMovement) { - return function (spectrum, detail) { - return moveBy$2(direction, isVerticalMovement, spectrum, detail).map(always); - }; - }; - var setToMin$2 = function (spectrum, detail) { - var mX = minX(detail); - var mY = minY(detail); - fireSliderChange$3(spectrum, sliderValue$2(mX, mY)); - }; - var setToMax$2 = function (spectrum, detail) { - var mX = maxX(detail); - var mY = maxY(detail); - fireSliderChange$3(spectrum, sliderValue$2(mX, mY)); - }; - var getValueFromEvent$2 = function (simulatedEvent) { - return getEventSource(simulatedEvent); - }; - var setPositionFromValue$2 = function (slider, thumb, detail, edges) { - var value = currentValue(detail); - var xPos = findPositionOfValue(slider, edges.getSpectrum(slider), value.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail); - var yPos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail); - var thumbXRadius = get$8(thumb.element) / 2; - var thumbYRadius = get$7(thumb.element) / 2; - set$2(thumb.element, 'left', xPos - thumbXRadius + 'px'); - set$2(thumb.element, 'top', yPos - thumbYRadius + 'px'); - }; - var onLeft$2 = handleMovement$2(-1, false); - var onRight$2 = handleMovement$2(1, false); - var onUp$2 = handleMovement$2(-1, true); - var onDown$2 = handleMovement$2(1, true); - var edgeActions$2 = { - 'top-left': Optional.some(setToTLEdgeXY), - 'top': Optional.some(setToTEdgeXY), - 'top-right': Optional.some(setToTREdgeXY), - 'right': Optional.some(setToREdgeXY), - 'bottom-right': Optional.some(setToBREdgeXY), - 'bottom': Optional.some(setToBEdgeXY), - 'bottom-left': Optional.some(setToBLEdgeXY), - 'left': Optional.some(setToLEdgeXY) - }; - - var TwoDModel = /*#__PURE__*/Object.freeze({ - __proto__: null, - setValueFrom: setValueFrom$2, - setToMin: setToMin$2, - setToMax: setToMax$2, - getValueFromEvent: getValueFromEvent$2, - setPositionFromValue: setPositionFromValue$2, - onLeft: onLeft$2, - onRight: onRight$2, - onUp: onUp$2, - onDown: onDown$2, - edgeActions: edgeActions$2 - }); - - var SliderSchema = [ - defaulted$1('stepSize', 1), - defaulted$1('onChange', noop), - defaulted$1('onChoose', noop), - defaulted$1('onInit', noop), - defaulted$1('onDragStart', noop), - defaulted$1('onDragEnd', noop), - defaulted$1('snapToGrid', false), - defaulted$1('rounded', true), - option('snapStart'), - strictOf('model', choose$1('mode', { - x: [ - defaulted$1('minX', 0), - defaulted$1('maxX', 100), - state$1('value', function (spec) { - return Cell(spec.mode.minX); - }), - strict$1('getInitialValue'), - output('manager', HorizontalModel) - ], - y: [ - defaulted$1('minY', 0), - defaulted$1('maxY', 100), - state$1('value', function (spec) { - return Cell(spec.mode.minY); - }), - strict$1('getInitialValue'), - output('manager', VerticalModel) - ], - xy: [ - defaulted$1('minX', 0), - defaulted$1('maxX', 100), - defaulted$1('minY', 0), - defaulted$1('maxY', 100), - state$1('value', function (spec) { - return Cell({ - x: spec.mode.minX, - y: spec.mode.minY - }); - }), - strict$1('getInitialValue'), - output('manager', TwoDModel) - ] - })), - field$1('sliderBehaviours', [ - Keying, - Representing - ]), - state$1('mouseIsDown', function () { - return Cell(false); - }) - ]; - - var sketch = function (detail, components, _spec, _externals) { - var _a; - var getThumb = function (component) { - return getPartOrDie(component, detail, 'thumb'); - }; - var getSpectrum = function (component) { - return getPartOrDie(component, detail, 'spectrum'); - }; - var getLeftEdge = function (component) { - return getPart(component, detail, 'left-edge'); - }; - var getRightEdge = function (component) { - return getPart(component, detail, 'right-edge'); - }; - var getTopEdge = function (component) { - return getPart(component, detail, 'top-edge'); - }; - var getBottomEdge = function (component) { - return getPart(component, detail, 'bottom-edge'); - }; - var modelDetail = detail.model; - var model = modelDetail.manager; - var refresh = function (slider, thumb) { - model.setPositionFromValue(slider, thumb, detail, { - getLeftEdge: getLeftEdge, - getRightEdge: getRightEdge, - getTopEdge: getTopEdge, - getBottomEdge: getBottomEdge, - getSpectrum: getSpectrum - }); - }; - var setValue = function (slider, newValue) { - modelDetail.value.set(newValue); - var thumb = getThumb(slider); - refresh(slider, thumb); - }; - var changeValue = function (slider, newValue) { - setValue(slider, newValue); - var thumb = getThumb(slider); - detail.onChange(slider, thumb, newValue); - return Optional.some(true); - }; - var resetToMin = function (slider) { - model.setToMin(slider, detail); - }; - var resetToMax = function (slider) { - model.setToMax(slider, detail); - }; - var choose = function (slider) { - var fireOnChoose = function () { - getPart(slider, detail, 'thumb').each(function (thumb) { - var value = modelDetail.value.get(); - detail.onChoose(slider, thumb, value); - }); - }; - var wasDown = detail.mouseIsDown.get(); - detail.mouseIsDown.set(false); - if (wasDown) { - fireOnChoose(); - } - }; - var onDragStart = function (slider, simulatedEvent) { - simulatedEvent.stop(); - detail.mouseIsDown.set(true); - detail.onDragStart(slider, getThumb(slider)); - }; - var onDragEnd = function (slider, simulatedEvent) { - simulatedEvent.stop(); - detail.onDragEnd(slider, getThumb(slider)); - choose(slider); - }; - return { - uid: detail.uid, - dom: detail.dom, - components: components, - behaviours: augment(detail.sliderBehaviours, [ - Keying.config({ - mode: 'special', - focusIn: function (slider) { - return getPart(slider, detail, 'spectrum').map(Keying.focusIn).map(always); - } - }), - Representing.config({ - store: { - mode: 'manual', - getValue: function (_) { - return modelDetail.value.get(); - } - } - }), - Receiving.config({ channels: (_a = {}, _a[mouseReleased()] = { onReceive: choose }, _a) }) - ]), - events: derive([ - run(sliderChangeEvent(), function (slider, simulatedEvent) { - changeValue(slider, simulatedEvent.event.value); - }), - runOnAttached(function (slider, _simulatedEvent) { - var getInitial = modelDetail.getInitialValue(); - modelDetail.value.set(getInitial); - var thumb = getThumb(slider); - refresh(slider, thumb); - var spectrum = getSpectrum(slider); - detail.onInit(slider, thumb, spectrum, modelDetail.value.get()); - }), - run(touchstart(), onDragStart), - run(touchend(), onDragEnd), - run(mousedown(), onDragStart), - run(mouseup(), onDragEnd) - ]), - apis: { - resetToMin: resetToMin, - resetToMax: resetToMax, - setValue: setValue, - refresh: refresh - }, - domModification: { styles: { position: 'relative' } } - }; - }; - - var Slider = composite$1({ - name: 'Slider', - configFields: SliderSchema, - partFields: SliderParts, - factory: sketch, - apis: { - setValue: function (apis, slider, value) { - apis.setValue(slider, value); - }, - resetToMin: function (apis, slider) { - apis.resetToMin(slider); - }, - resetToMax: function (apis, slider) { - apis.resetToMax(slider); - }, - refresh: function (apis, slider) { - apis.refresh(slider); - } - } - }); - - var hsvColour = function (hue, saturation, value) { - return { - hue: hue, - saturation: saturation, - value: value - }; - }; - var fromRgb = function (rgbaColour) { - var h = 0; - var s = 0; - var v = 0; - var r = rgbaColour.red / 255; - var g = rgbaColour.green / 255; - var b = rgbaColour.blue / 255; - var minRGB = Math.min(r, Math.min(g, b)); - var maxRGB = Math.max(r, Math.max(g, b)); - if (minRGB === maxRGB) { - v = minRGB; - return hsvColour(0, 0, v * 100); - } - var d = r === minRGB ? g - b : b === minRGB ? r - g : b - r; - h = r === minRGB ? 3 : b === minRGB ? 1 : 5; - h = 60 * (h - d / (maxRGB - minRGB)); - s = (maxRGB - minRGB) / maxRGB; - v = maxRGB; - return hsvColour(Math.round(h), Math.round(s * 100), Math.round(v * 100)); - }; - - var hexToHsv = function (hex) { - return fromRgb(fromHex(hex)); - }; - var hsvToHex = function (hsv) { - return fromRgba(fromHsv(hsv)); - }; - - var fieldsUpdate = generate$1('rgb-hex-update'); - var sliderUpdate = generate$1('slider-update'); - var paletteUpdate = generate$1('palette-update'); - - var sliderFactory = function (translate, getClass) { - var spectrum = Slider.parts.spectrum({ - dom: { - tag: 'div', - classes: [getClass('hue-slider-spectrum')], - attributes: { role: 'presentation' } - } - }); - var thumb = Slider.parts.thumb({ - dom: { - tag: 'div', - classes: [getClass('hue-slider-thumb')], - attributes: { role: 'presentation' } - } - }); - return Slider.sketch({ - dom: { - tag: 'div', - classes: [getClass('hue-slider')], - attributes: { role: 'presentation' } - }, - rounded: false, - model: { - mode: 'y', - getInitialValue: constant({ y: 0 }) - }, - components: [ - spectrum, - thumb - ], - sliderBehaviours: derive$1([Focusing.config({})]), - onChange: function (slider, _thumb, value) { - emitWith(slider, sliderUpdate, { value: value }); - } - }); - }; - - var owner$3 = 'form'; - var schema$h = [field$1('formBehaviours', [Representing])]; - var getPartName = function (name) { - return ''; - }; - var sketch$1 = function (fSpec) { - var parts = function () { - var record = []; - var field = function (name, config) { - record.push(name); - return generateOne(owner$3, getPartName(name), config); - }; - return { - field: field, - record: function () { - return record; - } - }; - }(); - var spec = fSpec(parts); - var partNames = parts.record(); - var fieldParts = map(partNames, function (n) { - return required({ - name: n, - pname: getPartName(n) - }); - }); - return composite(owner$3, schema$h, fieldParts, make$4, spec); - }; - var toResult$1 = function (o, e) { - return o.fold(function () { - return Result.error(e); - }, Result.value); - }; - var make$4 = function (detail, components) { - return { - uid: detail.uid, - dom: detail.dom, - components: components, - behaviours: augment(detail.formBehaviours, [Representing.config({ - store: { - mode: 'manual', - getValue: function (form) { - var resPs = getAllParts(form, detail); - return map$2(resPs, function (resPThunk, pName) { - return resPThunk().bind(function (v) { - var opt = Composing.getCurrent(v); - return toResult$1(opt, new Error('Cannot find a current component to extract the value from for form part \'' + pName + '\': ' + element(v.element))); - }).map(Representing.getValue); - }); - }, - setValue: function (form, values) { - each$1(values, function (newValue, key) { - getPart(form, detail, key).each(function (wrapper) { - Composing.getCurrent(wrapper).each(function (field) { - Representing.setValue(field, newValue); - }); - }); - }); - } - } - })]), - apis: { - getField: function (form, key) { - return getPart(form, detail, key).bind(Composing.getCurrent); - } - } - }; - }; - var Form = { - getField: makeApi(function (apis, component, key) { - return apis.getField(component, key); - }), - sketch: sketch$1 - }; - - var validInput = generate$1('valid-input'); - var invalidInput = generate$1('invalid-input'); - var validatingInput = generate$1('validating-input'); - var translatePrefix = 'colorcustom.rgb.'; - var rgbFormFactory = function (translate, getClass, onValidHexx, onInvalidHexx) { - var invalidation = function (label, isValid) { - return Invalidating.config({ - invalidClass: getClass('invalid'), - notify: { - onValidate: function (comp) { - emitWith(comp, validatingInput, { type: label }); - }, - onValid: function (comp) { - emitWith(comp, validInput, { - type: label, - value: Representing.getValue(comp) - }); - }, - onInvalid: function (comp) { - emitWith(comp, invalidInput, { - type: label, - value: Representing.getValue(comp) - }); - } - }, - validator: { - validate: function (comp) { - var value = Representing.getValue(comp); - var res = isValid(value) ? Result.value(true) : Result.error(translate('aria.input.invalid')); - return Future.pure(res); - }, - validateOnLoad: false - } - }); - }; - var renderTextField = function (isValid, name, label, description, data) { - var helptext = translate(translatePrefix + 'range'); - var pLabel = FormField.parts.label({ - dom: { - tag: 'label', - innerHtml: label, - attributes: { 'aria-label': description } - } - }); - var pField = FormField.parts.field({ - data: data, - factory: Input, - inputAttributes: __assign({ type: 'text' }, name === 'hex' ? { 'aria-live': 'polite' } : {}), - inputClasses: [getClass('textfield')], - inputBehaviours: derive$1([ - invalidation(name, isValid), - Tabstopping.config({}) - ]), - onSetValue: function (input) { - if (Invalidating.isInvalid(input)) { - var run = Invalidating.run(input); - run.get(noop); - } - } - }); - var comps = [ - pLabel, - pField - ]; - var concats = name !== 'hex' ? [FormField.parts['aria-descriptor']({ text: helptext })] : []; - var components = comps.concat(concats); - return { - dom: { - tag: 'div', - attributes: { role: 'presentation' } - }, - components: components - }; - }; - var copyRgbToHex = function (form, rgba) { - var hex = fromRgba(rgba); - Form.getField(form, 'hex').each(function (hexField) { - if (!Focusing.isFocused(hexField)) { - Representing.setValue(form, { hex: hex.value }); - } - }); - return hex; - }; - var copyRgbToForm = function (form, rgb) { - var red = rgb.red; - var green = rgb.green; - var blue = rgb.blue; - Representing.setValue(form, { - red: red, - green: green, - blue: blue - }); - }; - var memPreview = record({ - dom: { - tag: 'div', - classes: [getClass('rgba-preview')], - styles: { 'background-color': 'white' }, - attributes: { role: 'presentation' } - } - }); - var updatePreview = function (anyInSystem, hex) { - memPreview.getOpt(anyInSystem).each(function (preview) { - set$2(preview.element, 'background-color', '#' + hex.value); - }); - }; - var factory = function () { - var state = { - red: Cell(Optional.some(255)), - green: Cell(Optional.some(255)), - blue: Cell(Optional.some(255)), - hex: Cell(Optional.some('ffffff')) - }; - var copyHexToRgb = function (form, hex) { - var rgb = fromHex(hex); - copyRgbToForm(form, rgb); - setValueRgb(rgb); - }; - var get = function (prop) { - return state[prop].get(); - }; - var set = function (prop, value) { - state[prop].set(value); - }; - var getValueRgb = function () { - return get('red').bind(function (red) { - return get('green').bind(function (green) { - return get('blue').map(function (blue) { - return rgbaColour(red, green, blue, 1); - }); - }); - }); - }; - var setValueRgb = function (rgb) { - var red = rgb.red; - var green = rgb.green; - var blue = rgb.blue; - set('red', Optional.some(red)); - set('green', Optional.some(green)); - set('blue', Optional.some(blue)); - }; - var onInvalidInput = function (form, simulatedEvent) { - var data = simulatedEvent.event; - if (data.type !== 'hex') { - set(data.type, Optional.none()); - } else { - onInvalidHexx(form); - } - }; - var onValidHex = function (form, value) { - onValidHexx(form); - var hex = hexColour(value); - set('hex', Optional.some(value)); - var rgb = fromHex(hex); - copyRgbToForm(form, rgb); - setValueRgb(rgb); - emitWith(form, fieldsUpdate, { hex: hex }); - updatePreview(form, hex); - }; - var onValidRgb = function (form, prop, value) { - var val = parseInt(value, 10); - set(prop, Optional.some(val)); - getValueRgb().each(function (rgb) { - var hex = copyRgbToHex(form, rgb); - emitWith(form, fieldsUpdate, { hex: hex }); - updatePreview(form, hex); - }); - }; - var isHexInputEvent = function (data) { - return data.type === 'hex'; - }; - var onValidInput = function (form, simulatedEvent) { - var data = simulatedEvent.event; - if (isHexInputEvent(data)) { - onValidHex(form, data.value); - } else { - onValidRgb(form, data.type, data.value); - } - }; - var formPartStrings = function (key) { - return { - label: translate(translatePrefix + key + '.label'), - description: translate(translatePrefix + key + '.description') - }; - }; - var redStrings = formPartStrings('red'); - var greenStrings = formPartStrings('green'); - var blueStrings = formPartStrings('blue'); - var hexStrings = formPartStrings('hex'); - return deepMerge(Form.sketch(function (parts) { - return { - dom: { - tag: 'form', - classes: [getClass('rgb-form')], - attributes: { 'aria-label': translate('aria.color.picker') } - }, - components: [ - parts.field('red', FormField.sketch(renderTextField(isRgbaComponent, 'red', redStrings.label, redStrings.description, 255))), - parts.field('green', FormField.sketch(renderTextField(isRgbaComponent, 'green', greenStrings.label, greenStrings.description, 255))), - parts.field('blue', FormField.sketch(renderTextField(isRgbaComponent, 'blue', blueStrings.label, blueStrings.description, 255))), - parts.field('hex', FormField.sketch(renderTextField(isHexString, 'hex', hexStrings.label, hexStrings.description, 'ffffff'))), - memPreview.asSpec() - ], - formBehaviours: derive$1([ - Invalidating.config({ invalidClass: getClass('form-invalid') }), - config('rgb-form-events', [ - run(validInput, onValidInput), - run(invalidInput, onInvalidInput), - run(validatingInput, onInvalidInput) - ]) - ]) - }; - }), { - apis: { - updateHex: function (form, hex) { - Representing.setValue(form, { hex: hex.value }); - copyHexToRgb(form, hex); - updatePreview(form, hex); - } - } - }); - }; - var rgbFormSketcher = single$2({ - factory: factory, - name: 'RgbForm', - configFields: [], - apis: { - updateHex: function (apis, form, hex) { - apis.updateHex(form, hex); - } - }, - extraApis: {} - }); - return rgbFormSketcher; - }; - - var paletteFactory = function (_translate, getClass) { - var spectrumPart = Slider.parts.spectrum({ - dom: { - tag: 'canvas', - attributes: { role: 'presentation' }, - classes: [getClass('sv-palette-spectrum')] - } - }); - var thumbPart = Slider.parts.thumb({ - dom: { - tag: 'div', - attributes: { role: 'presentation' }, - classes: [getClass('sv-palette-thumb')], - innerHtml: '' - } - }); - var setColour = function (canvas, rgba) { - var width = canvas.width, height = canvas.height; - var ctx = canvas.getContext('2d'); - if (ctx === null) { - return; - } - ctx.fillStyle = rgba; - ctx.fillRect(0, 0, width, height); - var grdWhite = ctx.createLinearGradient(0, 0, width, 0); - grdWhite.addColorStop(0, 'rgba(255,255,255,1)'); - grdWhite.addColorStop(1, 'rgba(255,255,255,0)'); - ctx.fillStyle = grdWhite; - ctx.fillRect(0, 0, width, height); - var grdBlack = ctx.createLinearGradient(0, 0, 0, height); - grdBlack.addColorStop(0, 'rgba(0,0,0,0)'); - grdBlack.addColorStop(1, 'rgba(0,0,0,1)'); - ctx.fillStyle = grdBlack; - ctx.fillRect(0, 0, width, height); - }; - var setPaletteHue = function (slider, hue) { - var canvas = slider.components()[0].element.dom; - var hsv = hsvColour(hue, 100, 100); - var rgba = fromHsv(hsv); - setColour(canvas, toString(rgba)); - }; - var setPaletteThumb = function (slider, hex) { - var hsv = fromRgb(fromHex(hex)); - Slider.setValue(slider, { - x: hsv.saturation, - y: 100 - hsv.value - }); - }; - var factory = function (_detail) { - var getInitialValue = constant({ - x: 0, - y: 0 - }); - var onChange = function (slider, _thumb, value) { - emitWith(slider, paletteUpdate, { value: value }); - }; - var onInit = function (_slider, _thumb, spectrum, _value) { - setColour(spectrum.element.dom, toString(red)); - }; - var sliderBehaviours = derive$1([ - Composing.config({ find: Optional.some }), - Focusing.config({}) - ]); - return Slider.sketch({ - dom: { - tag: 'div', - attributes: { role: 'presentation' }, - classes: [getClass('sv-palette')] - }, - model: { - mode: 'xy', - getInitialValue: getInitialValue - }, - rounded: false, - components: [ - spectrumPart, - thumbPart - ], - onChange: onChange, - onInit: onInit, - sliderBehaviours: sliderBehaviours - }); - }; - var saturationBrightnessPaletteSketcher = single$2({ - factory: factory, - name: 'SaturationBrightnessPalette', - configFields: [], - apis: { - setHue: function (_apis, slider, hue) { - setPaletteHue(slider, hue); - }, - setThumb: function (_apis, slider, hex) { - setPaletteThumb(slider, hex); - } - }, - extraApis: {} - }); - return saturationBrightnessPaletteSketcher; - }; - - var makeFactory = function (translate, getClass) { - var factory = function (detail) { - var rgbForm = rgbFormFactory(translate, getClass, detail.onValidHex, detail.onInvalidHex); - var sbPalette = paletteFactory(translate, getClass); - var hueSliderToDegrees = function (hue) { - return (100 - hue) / 100 * 360; - }; - var hueDegreesToSlider = function (hue) { - return 100 - hue / 360 * 100; - }; - var state = { - paletteRgba: Cell(red), - paletteHue: Cell(0) - }; - var memSlider = record(sliderFactory(translate, getClass)); - var memPalette = record(sbPalette.sketch({})); - var memRgb = record(rgbForm.sketch({})); - var updatePalette = function (anyInSystem, _hex, hue) { - memPalette.getOpt(anyInSystem).each(function (palette) { - sbPalette.setHue(palette, hue); - }); - }; - var updateFields = function (anyInSystem, hex) { - memRgb.getOpt(anyInSystem).each(function (form) { - rgbForm.updateHex(form, hex); - }); - }; - var updateSlider = function (anyInSystem, _hex, hue) { - memSlider.getOpt(anyInSystem).each(function (slider) { - Slider.setValue(slider, { y: hueDegreesToSlider(hue) }); - }); - }; - var updatePaletteThumb = function (anyInSystem, hex) { - memPalette.getOpt(anyInSystem).each(function (palette) { - sbPalette.setThumb(palette, hex); - }); - }; - var updateState = function (hex, hue) { - var rgba = fromHex(hex); - state.paletteRgba.set(rgba); - state.paletteHue.set(hue); - }; - var runUpdates = function (anyInSystem, hex, hue, updates) { - updateState(hex, hue); - each(updates, function (update) { - update(anyInSystem, hex, hue); - }); - }; - var onPaletteUpdate = function () { - var updates = [updateFields]; - return function (form, simulatedEvent) { - var value = simulatedEvent.event.value; - var oldHue = state.paletteHue.get(); - var newHsv = hsvColour(oldHue, value.x, 100 - value.y); - var newHex = hsvToHex(newHsv); - runUpdates(form, newHex, oldHue, updates); - }; - }; - var onSliderUpdate = function () { - var updates = [ - updatePalette, - updateFields - ]; - return function (form, simulatedEvent) { - var hue = hueSliderToDegrees(simulatedEvent.event.value.y); - var oldRgb = state.paletteRgba.get(); - var oldHsv = fromRgb(oldRgb); - var newHsv = hsvColour(hue, oldHsv.saturation, oldHsv.value); - var newHex = hsvToHex(newHsv); - runUpdates(form, newHex, hue, updates); - }; - }; - var onFieldsUpdate = function () { - var updates = [ - updatePalette, - updateSlider, - updatePaletteThumb - ]; - return function (form, simulatedEvent) { - var hex = simulatedEvent.event.hex; - var hsv = hexToHsv(hex); - runUpdates(form, hex, hsv.hue, updates); - }; - }; - return { - uid: detail.uid, - dom: detail.dom, - components: [ - memPalette.asSpec(), - memSlider.asSpec(), - memRgb.asSpec() - ], - behaviours: derive$1([ - config('colour-picker-events', [ - run(fieldsUpdate, onFieldsUpdate()), - run(paletteUpdate, onPaletteUpdate()), - run(sliderUpdate, onSliderUpdate()) - ]), - Composing.config({ - find: function (comp) { - return memRgb.getOpt(comp); - } - }), - Keying.config({ mode: 'acyclic' }) - ]) - }; - }; - var colourPickerSketcher = single$2({ - name: 'ColourPicker', - configFields: [ - strict$1('dom'), - defaulted$1('onValidHex', noop), - defaulted$1('onInvalidHex', noop) - ], - factory: factory - }); - return colourPickerSketcher; - }; - - var self$1 = function () { - return Composing.config({ find: Optional.some }); - }; - var memento = function (mem) { - return Composing.config({ find: mem.getOpt }); - }; - var childAt = function (index) { - return Composing.config({ - find: function (comp) { - return child(comp.element, index).bind(function (element) { - return comp.getSystem().getByDom(element).toOptional(); - }); - } - }); - }; - var ComposingConfigs = { - self: self$1, - memento: memento, - childAt: childAt - }; - - var english = { - 'colorcustom.rgb.red.label': 'R', - 'colorcustom.rgb.red.description': 'Red component', - 'colorcustom.rgb.green.label': 'G', - 'colorcustom.rgb.green.description': 'Green component', - 'colorcustom.rgb.blue.label': 'B', - 'colorcustom.rgb.blue.description': 'Blue component', - 'colorcustom.rgb.hex.label': '#', - 'colorcustom.rgb.hex.description': 'Hex color code', - 'colorcustom.rgb.range': 'Range 0 to 255', - 'colorcustom.sb.saturation': 'Saturation', - 'colorcustom.sb.brightness': 'Brightness', - 'colorcustom.sb.picker': 'Saturation and Brightness Picker', - 'colorcustom.sb.palette': 'Saturation and Brightness Palette', - 'colorcustom.sb.instructions': 'Use arrow keys to select saturation and brightness, on x and y axes', - 'colorcustom.hue.hue': 'Hue', - 'colorcustom.hue.slider': 'Hue Slider', - 'colorcustom.hue.palette': 'Hue Palette', - 'colorcustom.hue.instructions': 'Use arrow keys to select a hue', - 'aria.color.picker': 'Color Picker', - 'aria.input.invalid': 'Invalid input' - }; - var getEnglishText = function (key) { - return english[key]; - }; - var translate$1 = function (key) { - return getEnglishText(key); - }; - var renderColorPicker = function (_spec) { - var getClass = function (key) { - return 'tox-' + key; - }; - var colourPickerFactory = makeFactory(translate$1, getClass); - var onValidHex = function (form) { - emitWith(form, formActionEvent, { - name: 'hex-valid', - value: true - }); - }; - var onInvalidHex = function (form) { - emitWith(form, formActionEvent, { - name: 'hex-valid', - value: false - }); - }; - var memPicker = record(colourPickerFactory.sketch({ - dom: { - tag: 'div', - classes: [getClass('color-picker-container')], - attributes: { role: 'presentation' } - }, - onValidHex: onValidHex, - onInvalidHex: onInvalidHex - })); - return { - dom: { tag: 'div' }, - components: [memPicker.asSpec()], - behaviours: derive$1([ - Representing.config({ - store: { - mode: 'manual', - getValue: function (comp) { - var picker = memPicker.get(comp); - var optRgbForm = Composing.getCurrent(picker); - var optHex = optRgbForm.bind(function (rgbForm) { - var formValues = Representing.getValue(rgbForm); - return formValues.hex; - }); - return optHex.map(function (hex) { - return '#' + hex; - }).getOr(''); - }, - setValue: function (comp, newValue) { - var pattern = /^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/; - var m = pattern.exec(newValue); - var picker = memPicker.get(comp); - var optRgbForm = Composing.getCurrent(picker); - optRgbForm.fold(function () { - console.log('Can not find form'); - }, function (rgbForm) { - Representing.setValue(rgbForm, { hex: Optional.from(m[1]).getOr('') }); - Form.getField(rgbForm, 'hex').each(function (hexField) { - emit(hexField, input()); - }); - }); - } - } - }), - ComposingConfigs.self() - ]) - }; - }; - - var global$b = tinymce.util.Tools.resolve('tinymce.Resource'); - - var isOldCustomEditor = function (spec) { - return Object.prototype.hasOwnProperty.call(spec, 'init'); - }; - var renderCustomEditor = function (spec) { - var editorApi = Cell(Optional.none()); - var memReplaced = record({ dom: { tag: spec.tag } }); - var initialValue = Cell(Optional.none()); - return { - dom: { - tag: 'div', - classes: ['tox-custom-editor'] - }, - behaviours: derive$1([ - config('custom-editor-events', [runOnAttached(function (component) { - memReplaced.getOpt(component).each(function (ta) { - (isOldCustomEditor(spec) ? spec.init(ta.element.dom) : global$b.load(spec.scriptId, spec.scriptUrl).then(function (init) { - return init(ta.element.dom, spec.settings); - })).then(function (ea) { - initialValue.get().each(function (cvalue) { - ea.setValue(cvalue); - }); - initialValue.set(Optional.none()); - editorApi.set(Optional.some(ea)); - }); - }); - })]), - Representing.config({ - store: { - mode: 'manual', - getValue: function () { - return editorApi.get().fold(function () { - return initialValue.get().getOr(''); - }, function (ed) { - return ed.getValue(); - }); - }, - setValue: function (component, value) { - editorApi.get().fold(function () { - initialValue.set(Optional.some(value)); - }, function (ed) { - return ed.setValue(value); - }); - } - } - }), - ComposingConfigs.self() - ]), - components: [memReplaced.asSpec()] - }; - }; - - var global$c = tinymce.util.Tools.resolve('tinymce.util.Tools'); - - var processors = objOf([ - defaulted$1('preprocess', identity), - defaulted$1('postprocess', identity) - ]); - var memento$1 = function (mem, rawProcessors) { - var ps = asRawOrDie('RepresentingConfigs.memento processors', processors, rawProcessors); - return Representing.config({ - store: { - mode: 'manual', - getValue: function (comp) { - var other = mem.get(comp); - var rawValue = Representing.getValue(other); - return ps.postprocess(rawValue); - }, - setValue: function (comp, rawValue) { - var newValue = ps.preprocess(rawValue); - var other = mem.get(comp); - Representing.setValue(other, newValue); - } - } - }); - }; - var withComp = function (optInitialValue, getter, setter) { - return Representing.config(deepMerge({ - store: { - mode: 'manual', - getValue: getter, - setValue: setter - } - }, optInitialValue.map(function (initialValue) { - return { store: { initialValue: initialValue } }; - }).getOr({}))); - }; - var withElement = function (initialValue, getter, setter) { - return withComp(initialValue, function (c) { - return getter(c.element); - }, function (c, v) { - return setter(c.element, v); - }); - }; - var domValue = function (optInitialValue) { - return withElement(optInitialValue, get$6, set$3); - }; - var domHtml = function (optInitialValue) { - return withElement(optInitialValue, get$2, set); - }; - var memory$1 = function (initialValue) { - return Representing.config({ - store: { - mode: 'memory', - initialValue: initialValue - } - }); - }; - var RepresentingConfigs = { - memento: memento$1, - withElement: withElement, - withComp: withComp, - domValue: domValue, - domHtml: domHtml, - memory: memory$1 - }; - - var defaultImageFileTypes = 'jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp'; - var filterByExtension = function (files, providersBackstage) { - var allowedImageFileTypes = global$c.explode(providersBackstage.getSetting('images_file_types', defaultImageFileTypes, 'string')); - var isFileInAllowedTypes = function (file) { - return exists(allowedImageFileTypes, function (type) { - return endsWith(file.name.toLowerCase(), '.' + type.toLowerCase()); - }); - }; - return filter(from$1(files), isFileInAllowedTypes); - }; - var renderDropZone = function (spec, providersBackstage) { - var stopper = function (_, se) { - se.stop(); - }; - var sequence = function (actions) { - return function (comp, se) { - each(actions, function (a) { - a(comp, se); - }); - }; - }; - var onDrop = function (comp, se) { - if (!Disabling.isDisabled(comp)) { - var transferEvent = se.event.raw; - handleFiles(comp, transferEvent.dataTransfer.files); - } - }; - var onSelect = function (component, simulatedEvent) { - var input = simulatedEvent.event.raw.target; - handleFiles(component, input.files); - }; - var handleFiles = function (component, files) { - Representing.setValue(component, filterByExtension(files, providersBackstage)); - emitWith(component, formChangeEvent, { name: spec.name }); - }; - var memInput = record({ - dom: { - tag: 'input', - attributes: { - type: 'file', - accept: 'image/*' - }, - styles: { display: 'none' } - }, - behaviours: derive$1([config('input-file-events', [ - cutter(click()), - cutter(tap()) - ])]) - }); - var renderField = function (s) { - return { - uid: s.uid, - dom: { - tag: 'div', - classes: ['tox-dropzone-container'] - }, - behaviours: derive$1([ - RepresentingConfigs.memory([]), - ComposingConfigs.self(), - Disabling.config({}), - Toggling.config({ - toggleClass: 'dragenter', - toggleOnExecute: false - }), - config('dropzone-events', [ - run('dragenter', sequence([ - stopper, - Toggling.toggle - ])), - run('dragleave', sequence([ - stopper, - Toggling.toggle - ])), - run('dragover', stopper), - run('drop', sequence([ - stopper, - onDrop - ])), - run(change(), onSelect) - ]) - ]), - components: [{ - dom: { - tag: 'div', - classes: ['tox-dropzone'], - styles: {} - }, - components: [ - { - dom: { - tag: 'p', - innerHtml: providersBackstage.translate('Drop an image here') - } - }, - Button.sketch({ - dom: { - tag: 'button', - innerHtml: providersBackstage.translate('Browse for an image'), - styles: { position: 'relative' }, - classes: [ - 'tox-button', - 'tox-button--secondary' - ] - }, - components: [memInput.asSpec()], - action: function (comp) { - var inputComp = memInput.get(comp); - inputComp.element.dom.click(); - }, - buttonBehaviours: derive$1([ - Tabstopping.config({}), - DisablingConfigs.button(providersBackstage.isDisabled), - receivingConfig() - ]) - }) - ] - }] - }; - }; - var pLabel = spec.label.map(function (label) { - return renderLabel(label, providersBackstage); - }); - var pField = FormField.parts.field({ factory: { sketch: renderField } }); - return renderFormFieldWith(pLabel, pField, ['tox-form__group--stretched'], []); - }; - - var renderGrid = function (spec, backstage) { - return { - dom: { - tag: 'div', - classes: [ - 'tox-form__grid', - 'tox-form__grid--' + spec.columns + 'col' - ] - }, - components: map(spec.items, backstage.interpreter) - }; - }; - - var beforeObject = generate$1('alloy-fake-before-tabstop'); - var afterObject = generate$1('alloy-fake-after-tabstop'); - var craftWithClasses = function (classes) { - return { - dom: { - tag: 'div', - styles: { - width: '1px', - height: '1px', - outline: 'none' - }, - attributes: { tabindex: '0' }, - classes: classes - }, - behaviours: derive$1([ - Focusing.config({ ignore: true }), - Tabstopping.config({}) - ]) - }; - }; - var craft = function (spec) { - return { - dom: { - tag: 'div', - classes: ['tox-navobj'] - }, - components: [ - craftWithClasses([beforeObject]), - spec, - craftWithClasses([afterObject]) - ], - behaviours: derive$1([ComposingConfigs.childAt(1)]) - }; - }; - var triggerTab = function (placeholder, shiftKey) { - emitWith(placeholder, keydown(), { - raw: { - which: 9, - shiftKey: shiftKey - } - }); - }; - var onFocus$1 = function (container, targetComp) { - var target = targetComp.element; - if (has$2(target, beforeObject)) { - triggerTab(container, true); - } else if (has$2(target, afterObject)) { - triggerTab(container, false); - } - }; - var isPseudoStop = function (element) { - return closest$4(element, [ - '.' + beforeObject, - '.' + afterObject - ].join(','), never); - }; - - var platformNeedsSandboxing = !(detect$3().browser.isIE() || detect$3().browser.isEdge()); - var getDynamicSource = function (isSandbox) { - var cachedValue = Cell(''); - return { - getValue: function (_frameComponent) { - return cachedValue.get(); - }, - setValue: function (frameComponent, html) { - if (!isSandbox) { - set$1(frameComponent.element, 'src', 'javascript:\'\''); - var doc = frameComponent.element.dom.contentWindow.document; - doc.open(); - doc.write(html); - doc.close(); - } else { - set$1(frameComponent.element, 'srcdoc', html); - } - cachedValue.set(html); - } - }; - }; - var renderIFrame = function (spec, providersBackstage) { - var isSandbox = platformNeedsSandboxing && spec.sandboxed; - var attributes = __assign(__assign({}, spec.label.map(function (title) { - return { title: title }; - }).getOr({})), isSandbox ? { sandbox: 'allow-scripts allow-same-origin' } : {}); - var sourcing = getDynamicSource(isSandbox); - var pLabel = spec.label.map(function (label) { - return renderLabel(label, providersBackstage); - }); - var factory = function (newSpec) { - return craft({ - uid: newSpec.uid, - dom: { - tag: 'iframe', - attributes: attributes - }, - behaviours: derive$1([ - Tabstopping.config({}), - Focusing.config({}), - RepresentingConfigs.withComp(Optional.none(), sourcing.getValue, sourcing.setValue) - ]) - }); - }; - var pField = FormField.parts.field({ factory: { sketch: factory } }); - return renderFormFieldWith(pLabel, pField, ['tox-form__group--stretched'], []); - }; - - var create$5 = function (width, height) { - return resize(document.createElement('canvas'), width, height); - }; - var clone$1 = function (canvas) { - var tCanvas = create$5(canvas.width, canvas.height); - var ctx = get2dContext(tCanvas); - ctx.drawImage(canvas, 0, 0); - return tCanvas; - }; - var get2dContext = function (canvas) { - return canvas.getContext('2d'); - }; - var resize = function (canvas, width, height) { - canvas.width = width; - canvas.height = height; - return canvas; - }; - - var getWidth = function (image) { - return image.naturalWidth || image.width; - }; - var getHeight = function (image) { - return image.naturalHeight || image.height; - }; - - var promise = function () { - var Promise = function (fn) { - if (typeof this !== 'object') { - throw new TypeError('Promises must be constructed via new'); - } - if (typeof fn !== 'function') { - throw new TypeError('not a function'); - } - this._state = null; - this._value = null; - this._deferreds = []; - doResolve(fn, bind(resolve, this), bind(reject, this)); - }; - var anyWindow = window; - var asap = Promise.immediateFn || typeof anyWindow.setImmediate === 'function' && anyWindow.setImmediate || function (fn) { - return setTimeout(fn, 1); - }; - var bind = function (fn, thisArg) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return fn.apply(thisArg, args); - }; - }; - var isArray = Array.isArray || function (value) { - return Object.prototype.toString.call(value) === '[object Array]'; - }; - function handle(deferred) { - var me = this; - if (this._state === null) { - this._deferreds.push(deferred); - return; - } - asap(function () { - var cb = me._state ? deferred.onFulfilled : deferred.onRejected; - if (cb === null) { - (me._state ? deferred.resolve : deferred.reject)(me._value); - return; - } - var ret; - try { - ret = cb(me._value); - } catch (e) { - deferred.reject(e); - return; - } - deferred.resolve(ret); - }); - } - function resolve(newValue) { - try { - if (newValue === this) { - throw new TypeError('A promise cannot be resolved with itself.'); - } - if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { - var then = newValue.then; - if (typeof then === 'function') { - doResolve(bind(then, newValue), bind(resolve, this), bind(reject, this)); - return; - } - } - this._state = true; - this._value = newValue; - finale.call(this); - } catch (e) { - reject.call(this, e); - } - } - function reject(newValue) { - this._state = false; - this._value = newValue; - finale.call(this); - } - function finale() { - for (var _i = 0, _a = this._deferreds; _i < _a.length; _i++) { - var deferred = _a[_i]; - handle.call(this, deferred); - } - this._deferreds = []; - } - function Handler(onFulfilled, onRejected, resolve, reject) { - this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; - this.onRejected = typeof onRejected === 'function' ? onRejected : null; - this.resolve = resolve; - this.reject = reject; - } - var doResolve = function (fn, onFulfilled, onRejected) { - var done = false; - try { - fn(function (value) { - if (done) { - return; - } - done = true; - onFulfilled(value); - }, function (reason) { - if (done) { - return; - } - done = true; - onRejected(reason); - }); - } catch (ex) { - if (done) { - return; - } - done = true; - onRejected(ex); - } - }; - Promise.prototype.catch = function (onRejected) { - return this.then(null, onRejected); - }; - Promise.prototype.then = function (onFulfilled, onRejected) { - var me = this; - return new Promise(function (resolve, reject) { - handle.call(me, new Handler(onFulfilled, onRejected, resolve, reject)); - }); - }; - Promise.all = function () { - var values = []; - for (var _i = 0; _i < arguments.length; _i++) { - values[_i] = arguments[_i]; - } - var args = Array.prototype.slice.call(values.length === 1 && isArray(values[0]) ? values[0] : values); - return new Promise(function (resolve, reject) { - if (args.length === 0) { - return resolve([]); - } - var remaining = args.length; - var res = function (i, val) { - try { - if (val && (typeof val === 'object' || typeof val === 'function')) { - var then = val.then; - if (typeof then === 'function') { - then.call(val, function (val) { - res(i, val); - }, reject); - return; - } - } - args[i] = val; - if (--remaining === 0) { - resolve(args); - } - } catch (ex) { - reject(ex); - } - }; - for (var i = 0; i < args.length; i++) { - res(i, args[i]); - } - }); - }; - Promise.resolve = function (value) { - if (value && typeof value === 'object' && value.constructor === Promise) { - return value; - } - return new Promise(function (resolve) { - resolve(value); - }); - }; - Promise.reject = function (reason) { - return new Promise(function (resolve, reject) { - reject(reason); - }); - }; - Promise.race = function (values) { - return new Promise(function (resolve, reject) { - for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { - var value = values_1[_i]; - value.then(resolve, reject); - } - }); - }; - return Promise; - }; - var Promise$1 = window.Promise ? window.Promise : promise(); - - var blobToImage = function (blob) { - return new Promise$1(function (resolve, reject) { - var blobUrl = URL.createObjectURL(blob); - var image = new Image(); - var removeListeners = function () { - image.removeEventListener('load', loaded); - image.removeEventListener('error', error); - }; - var loaded = function () { - removeListeners(); - resolve(image); - }; - var error = function () { - removeListeners(); - reject('Unable to load data of type ' + blob.type + ': ' + blobUrl); - }; - image.addEventListener('load', loaded); - image.addEventListener('error', error); - image.src = blobUrl; - if (image.complete) { - setTimeout(loaded, 0); - } - }); - }; - var dataUriToBlobSync = function (uri) { - var data = uri.split(','); - var matches = /data:([^;]+)/.exec(data[0]); - if (!matches) { - return Optional.none(); - } - var mimetype = matches[1]; - var base64 = data[1]; - var sliceSize = 1024; - var byteCharacters = atob(base64); - var bytesLength = byteCharacters.length; - var slicesCount = Math.ceil(bytesLength / sliceSize); - var byteArrays = new Array(slicesCount); - for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) { - var begin = sliceIndex * sliceSize; - var end = Math.min(begin + sliceSize, bytesLength); - var bytes = new Array(end - begin); - for (var offset = begin, i = 0; offset < end; ++i, ++offset) { - bytes[i] = byteCharacters[offset].charCodeAt(0); - } - byteArrays[sliceIndex] = new Uint8Array(bytes); - } - return Optional.some(new Blob(byteArrays, { type: mimetype })); - }; - var dataUriToBlob = function (uri) { - return new Promise$1(function (resolve, reject) { - dataUriToBlobSync(uri).fold(function () { - reject('uri is not base64: ' + uri); - }, resolve); - }); - }; - var canvasToBlob = function (canvas, type, quality) { - type = type || 'image/png'; - if (isFunction(HTMLCanvasElement.prototype.toBlob)) { - return new Promise$1(function (resolve, reject) { - canvas.toBlob(function (blob) { - if (blob) { - resolve(blob); - } else { - reject(); - } - }, type, quality); - }); - } else { - return dataUriToBlob(canvas.toDataURL(type, quality)); - } - }; - var canvasToDataURL = function (canvas, type, quality) { - type = type || 'image/png'; - return canvas.toDataURL(type, quality); - }; - var blobToCanvas = function (blob) { - return blobToImage(blob).then(function (image) { - revokeImageUrl(image); - var canvas = create$5(getWidth(image), getHeight(image)); - var context = get2dContext(canvas); - context.drawImage(image, 0, 0); - return canvas; - }); - }; - var blobToDataUri = function (blob) { - return new Promise$1(function (resolve) { - var reader = new FileReader(); - reader.onloadend = function () { - resolve(reader.result); - }; - reader.readAsDataURL(blob); - }); - }; - var revokeImageUrl = function (image) { - URL.revokeObjectURL(image.src); - }; - - var create$6 = function (getCanvas, blob, uri) { - var initialType = blob.type; - var getType = constant(initialType); - var toBlob = function () { - return Promise$1.resolve(blob); - }; - var toDataURL = constant(uri); - var toBase64 = function () { - return uri.split(',')[1]; - }; - var toAdjustedBlob = function (type, quality) { - return getCanvas.then(function (canvas) { - return canvasToBlob(canvas, type, quality); - }); - }; - var toAdjustedDataURL = function (type, quality) { - return getCanvas.then(function (canvas) { - return canvasToDataURL(canvas, type, quality); - }); - }; - var toAdjustedBase64 = function (type, quality) { - return toAdjustedDataURL(type, quality).then(function (dataurl) { - return dataurl.split(',')[1]; - }); - }; - var toCanvas = function () { - return getCanvas.then(clone$1); - }; - return { - getType: getType, - toBlob: toBlob, - toDataURL: toDataURL, - toBase64: toBase64, - toAdjustedBlob: toAdjustedBlob, - toAdjustedDataURL: toAdjustedDataURL, - toAdjustedBase64: toAdjustedBase64, - toCanvas: toCanvas - }; - }; - var fromBlob = function (blob) { - return blobToDataUri(blob).then(function (uri) { - return create$6(blobToCanvas(blob), blob, uri); - }); - }; - var fromCanvas = function (canvas, type) { - return canvasToBlob(canvas, type).then(function (blob) { - return create$6(Promise$1.resolve(canvas), blob, canvas.toDataURL()); - }); - }; - - var blobToImageResult = function (blob) { - return fromBlob(blob); - }; - - var clamp$1 = function (value, min, max) { - var parsedValue = typeof value === 'string' ? parseFloat(value) : value; - if (parsedValue > max) { - parsedValue = max; - } else if (parsedValue < min) { - parsedValue = min; - } - return parsedValue; - }; - var identity$1 = function () { - return [ - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1 - ]; - }; - var DELTA_INDEX = [ - 0, - 0.01, - 0.02, - 0.04, - 0.05, - 0.06, - 0.07, - 0.08, - 0.1, - 0.11, - 0.12, - 0.14, - 0.15, - 0.16, - 0.17, - 0.18, - 0.2, - 0.21, - 0.22, - 0.24, - 0.25, - 0.27, - 0.28, - 0.3, - 0.32, - 0.34, - 0.36, - 0.38, - 0.4, - 0.42, - 0.44, - 0.46, - 0.48, - 0.5, - 0.53, - 0.56, - 0.59, - 0.62, - 0.65, - 0.68, - 0.71, - 0.74, - 0.77, - 0.8, - 0.83, - 0.86, - 0.89, - 0.92, - 0.95, - 0.98, - 1, - 1.06, - 1.12, - 1.18, - 1.24, - 1.3, - 1.36, - 1.42, - 1.48, - 1.54, - 1.6, - 1.66, - 1.72, - 1.78, - 1.84, - 1.9, - 1.96, - 2, - 2.12, - 2.25, - 2.37, - 2.5, - 2.62, - 2.75, - 2.87, - 3, - 3.2, - 3.4, - 3.6, - 3.8, - 4, - 4.3, - 4.7, - 4.9, - 5, - 5.5, - 6, - 6.5, - 6.8, - 7, - 7.3, - 7.5, - 7.8, - 8, - 8.4, - 8.7, - 9, - 9.4, - 9.6, - 9.8, - 10 - ]; - var multiply = function (matrix1, matrix2) { - var col = []; - var out = new Array(25); - var val; - for (var i = 0; i < 5; i++) { - for (var j = 0; j < 5; j++) { - col[j] = matrix2[j + i * 5]; - } - for (var j = 0; j < 5; j++) { - val = 0; - for (var k = 0; k < 5; k++) { - val += matrix1[j + k * 5] * col[k]; - } - out[j + i * 5] = val; - } - } - return out; - }; - var adjustContrast = function (matrix, value) { - var x; - value = clamp$1(value, -1, 1); - value *= 100; - if (value < 0) { - x = 127 + value / 100 * 127; - } else { - x = value % 1; - if (x === 0) { - x = DELTA_INDEX[value]; - } else { - x = DELTA_INDEX[Math.floor(value)] * (1 - x) + DELTA_INDEX[Math.floor(value) + 1] * x; - } - x = x * 127 + 127; - } - return multiply(matrix, [ - x / 127, - 0, - 0, - 0, - 0.5 * (127 - x), - 0, - x / 127, - 0, - 0, - 0.5 * (127 - x), - 0, - 0, - x / 127, - 0, - 0.5 * (127 - x), - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1 - ]); - }; - var adjustBrightness = function (matrix, value) { - value = clamp$1(255 * value, -255, 255); - return multiply(matrix, [ - 1, - 0, - 0, - 0, - value, - 0, - 1, - 0, - 0, - value, - 0, - 0, - 1, - 0, - value, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1 - ]); - }; - var adjustColors = function (matrix, adjustR, adjustG, adjustB) { - adjustR = clamp$1(adjustR, 0, 2); - adjustG = clamp$1(adjustG, 0, 2); - adjustB = clamp$1(adjustB, 0, 2); - return multiply(matrix, [ - adjustR, - 0, - 0, - 0, - 0, - 0, - adjustG, - 0, - 0, - 0, - 0, - 0, - adjustB, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1 - ]); - }; - - var colorFilter = function (ir, matrix) { - return ir.toCanvas().then(function (canvas) { - return applyColorFilter(canvas, ir.getType(), matrix); - }); - }; - var applyColorFilter = function (canvas, type, matrix) { - var context = get2dContext(canvas); - var applyMatrix = function (pixelsData, m) { - var r, g, b, a; - var data = pixelsData.data, m0 = m[0], m1 = m[1], m2 = m[2], m3 = m[3], m4 = m[4], m5 = m[5], m6 = m[6], m7 = m[7], m8 = m[8], m9 = m[9], m10 = m[10], m11 = m[11], m12 = m[12], m13 = m[13], m14 = m[14], m15 = m[15], m16 = m[16], m17 = m[17], m18 = m[18], m19 = m[19]; - for (var i = 0; i < data.length; i += 4) { - r = data[i]; - g = data[i + 1]; - b = data[i + 2]; - a = data[i + 3]; - data[i] = r * m0 + g * m1 + b * m2 + a * m3 + m4; - data[i + 1] = r * m5 + g * m6 + b * m7 + a * m8 + m9; - data[i + 2] = r * m10 + g * m11 + b * m12 + a * m13 + m14; - data[i + 3] = r * m15 + g * m16 + b * m17 + a * m18 + m19; - } - return pixelsData; - }; - var pixels = applyMatrix(context.getImageData(0, 0, canvas.width, canvas.height), matrix); - context.putImageData(pixels, 0, 0); - return fromCanvas(canvas, type); - }; - var convoluteFilter = function (ir, matrix) { - return ir.toCanvas().then(function (canvas) { - return applyConvoluteFilter(canvas, ir.getType(), matrix); - }); - }; - var applyConvoluteFilter = function (canvas, type, matrix) { - var context = get2dContext(canvas); - var applyMatrix = function (pIn, pOut, aMatrix) { - var clamp = function (value, min, max) { - if (value > max) { - value = max; - } else if (value < min) { - value = min; - } - return value; - }; - var side = Math.round(Math.sqrt(aMatrix.length)); - var halfSide = Math.floor(side / 2); - var rgba = pIn.data; - var drgba = pOut.data; - var w = pIn.width; - var h = pIn.height; - for (var y = 0; y < h; y++) { - for (var x = 0; x < w; x++) { - var r = 0; - var g = 0; - var b = 0; - for (var cy = 0; cy < side; cy++) { - for (var cx = 0; cx < side; cx++) { - var scx = clamp(x + cx - halfSide, 0, w - 1); - var scy = clamp(y + cy - halfSide, 0, h - 1); - var innerOffset = (scy * w + scx) * 4; - var wt = aMatrix[cy * side + cx]; - r += rgba[innerOffset] * wt; - g += rgba[innerOffset + 1] * wt; - b += rgba[innerOffset + 2] * wt; - } - } - var offset = (y * w + x) * 4; - drgba[offset] = clamp(r, 0, 255); - drgba[offset + 1] = clamp(g, 0, 255); - drgba[offset + 2] = clamp(b, 0, 255); - } - } - return pOut; - }; - var pixelsIn = context.getImageData(0, 0, canvas.width, canvas.height); - var pixelsOut = context.getImageData(0, 0, canvas.width, canvas.height); - pixelsOut = applyMatrix(pixelsIn, pixelsOut, matrix); - context.putImageData(pixelsOut, 0, 0); - return fromCanvas(canvas, type); - }; - var functionColorFilter = function (colorFn) { - var filterImpl = function (canvas, type, value) { - var context = get2dContext(canvas); - var lookup = new Array(256); - var applyLookup = function (pixelsData, lookupData) { - var data = pixelsData.data; - for (var i = 0; i < data.length; i += 4) { - data[i] = lookupData[data[i]]; - data[i + 1] = lookupData[data[i + 1]]; - data[i + 2] = lookupData[data[i + 2]]; - } - return pixelsData; - }; - for (var i = 0; i < lookup.length; i++) { - lookup[i] = colorFn(i, value); - } - var pixels = applyLookup(context.getImageData(0, 0, canvas.width, canvas.height), lookup); - context.putImageData(pixels, 0, 0); - return fromCanvas(canvas, type); - }; - return function (ir, value) { - return ir.toCanvas().then(function (canvas) { - return filterImpl(canvas, ir.getType(), value); - }); - }; - }; - var complexAdjustableColorFilter = function (matrixAdjustFn) { - return function (ir, adjust) { - return colorFilter(ir, matrixAdjustFn(identity$1(), adjust)); - }; - }; - var basicColorFilter = function (matrix) { - return function (ir) { - return colorFilter(ir, matrix); - }; - }; - var basicConvolutionFilter = function (kernel) { - return function (ir) { - return convoluteFilter(ir, kernel); - }; - }; - var invert = basicColorFilter([ - -1, - 0, - 0, - 0, - 255, - 0, - -1, - 0, - 0, - 255, - 0, - 0, - -1, - 0, - 255, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0, - 1 - ]); - var brightness = complexAdjustableColorFilter(adjustBrightness); - var contrast = complexAdjustableColorFilter(adjustContrast); - var colorize = function (ir, adjustR, adjustG, adjustB) { - return colorFilter(ir, adjustColors(identity$1(), adjustR, adjustG, adjustB)); - }; - var sharpen = basicConvolutionFilter([ - 0, - -1, - 0, - -1, - 5, - -1, - 0, - -1, - 0 - ]); - var gamma = functionColorFilter(function (color, value) { - return Math.pow(color / 255, 1 - value) * 255; - }); - - var scale = function (image, dW, dH) { - var sW = getWidth(image); - var sH = getHeight(image); - var wRatio = dW / sW; - var hRatio = dH / sH; - var scaleCapped = false; - if (wRatio < 0.5 || wRatio > 2) { - wRatio = wRatio < 0.5 ? 0.5 : 2; - scaleCapped = true; - } - if (hRatio < 0.5 || hRatio > 2) { - hRatio = hRatio < 0.5 ? 0.5 : 2; - scaleCapped = true; - } - var scaled = _scale(image, wRatio, hRatio); - return !scaleCapped ? scaled : scaled.then(function (tCanvas) { - return scale(tCanvas, dW, dH); - }); - }; - var _scale = function (image, wRatio, hRatio) { - return new Promise$1(function (resolve) { - var sW = getWidth(image); - var sH = getHeight(image); - var dW = Math.floor(sW * wRatio); - var dH = Math.floor(sH * hRatio); - var canvas = create$5(dW, dH); - var context = get2dContext(canvas); - context.drawImage(image, 0, 0, sW, sH, 0, 0, dW, dH); - resolve(canvas); - }); - }; - - var ceilWithPrecision = function (num, precision) { - if (precision === void 0) { - precision = 2; - } - var mul = Math.pow(10, precision); - var upper = Math.round(num * mul); - return Math.ceil(upper / mul); - }; - var rotate = function (ir, angle) { - return ir.toCanvas().then(function (canvas) { - return applyRotate(canvas, ir.getType(), angle); - }); - }; - var applyRotate = function (image, type, angle) { - var degrees = angle < 0 ? 360 + angle : angle; - var rad = degrees * Math.PI / 180; - var width = image.width; - var height = image.height; - var sin = Math.sin(rad); - var cos = Math.cos(rad); - var newWidth = ceilWithPrecision(Math.abs(width * cos) + Math.abs(height * sin)); - var newHeight = ceilWithPrecision(Math.abs(width * sin) + Math.abs(height * cos)); - var canvas = create$5(newWidth, newHeight); - var context = get2dContext(canvas); - context.translate(newWidth / 2, newHeight / 2); - context.rotate(rad); - context.drawImage(image, -width / 2, -height / 2); - return fromCanvas(canvas, type); - }; - var flip = function (ir, axis) { - return ir.toCanvas().then(function (canvas) { - return applyFlip(canvas, ir.getType(), axis); - }); - }; - var applyFlip = function (image, type, axis) { - var canvas = create$5(image.width, image.height); - var context = get2dContext(canvas); - if (axis === 'v') { - context.scale(1, -1); - context.drawImage(image, 0, -canvas.height); - } else { - context.scale(-1, 1); - context.drawImage(image, -canvas.width, 0); - } - return fromCanvas(canvas, type); - }; - var crop = function (ir, x, y, w, h) { - return ir.toCanvas().then(function (canvas) { - return applyCrop(canvas, ir.getType(), x, y, w, h); - }); - }; - var applyCrop = function (image, type, x, y, w, h) { - var canvas = create$5(w, h); - var context = get2dContext(canvas); - context.drawImage(image, -x, -y); - return fromCanvas(canvas, type); - }; - var resize$1 = function (ir, w, h) { - return ir.toCanvas().then(function (canvas) { - return scale(canvas, w, h).then(function (newCanvas) { - return fromCanvas(newCanvas, ir.getType()); - }); - }); - }; - - var invert$1 = function (ir) { - return invert(ir); - }; - var sharpen$1 = function (ir) { - return sharpen(ir); - }; - var gamma$1 = function (ir, value) { - return gamma(ir, value); - }; - var colorize$1 = function (ir, adjustR, adjustG, adjustB) { - return colorize(ir, adjustR, adjustG, adjustB); - }; - var brightness$1 = function (ir, adjust) { - return brightness(ir, adjust); - }; - var contrast$1 = function (ir, adjust) { - return contrast(ir, adjust); - }; - var flip$1 = function (ir, axis) { - return flip(ir, axis); - }; - var crop$1 = function (ir, x, y, w, h) { - return crop(ir, x, y, w, h); - }; - var resize$2 = function (ir, w, h) { - return resize$1(ir, w, h); - }; - var rotate$1 = function (ir, angle) { - return rotate(ir, angle); - }; - - var renderIcon$1 = function (iconHtml, behaviours) { - return __assign({ - dom: { - tag: 'span', - innerHtml: iconHtml, - classes: [ - 'tox-icon', - 'tox-tbtn__icon-wrap' - ] - } - }, behaviours); - }; - var renderIconFromPack = function (iconName, iconsProvider) { - return renderIcon$1(get$e(iconName, iconsProvider), {}); - }; - var renderReplacableIconFromPack = function (iconName, iconsProvider) { - return renderIcon$1(get$e(iconName, iconsProvider), { behaviours: derive$1([Replacing.config({})]) }); - }; - var renderLabel$1 = function (text, prefix, providersBackstage) { - return { - dom: { - tag: 'span', - innerHtml: providersBackstage.translate(text), - classes: [prefix + '__select-label'] - }, - behaviours: derive$1([Replacing.config({})]) - }; - }; - - var _a$1; - var internalToolbarButtonExecute = generate$1('toolbar.button.execute'); - var onToolbarButtonExecute = function (info) { - return runOnExecute(function (comp, _simulatedEvent) { - runWithApi(info, comp)(function (itemApi) { - emitWith(comp, internalToolbarButtonExecute, { buttonApi: itemApi }); - info.onAction(itemApi); - }); - }); - }; - var toolbarButtonEventOrder = (_a$1 = {}, _a$1[execute()] = [ - 'disabling', - 'alloy.base.behaviour', - 'toggling', - 'toolbar-button-events' - ], _a$1); - - var updateMenuText = generate$1('update-menu-text'); - var updateMenuIcon = generate$1('update-menu-icon'); - var renderCommonDropdown = function (spec, prefix, sharedBackstage) { - var editorOffCell = Cell(noop); - var optMemDisplayText = spec.text.map(function (text) { - return record(renderLabel$1(text, prefix, sharedBackstage.providers)); - }); - var optMemDisplayIcon = spec.icon.map(function (iconName) { - return record(renderReplacableIconFromPack(iconName, sharedBackstage.providers.icons)); - }); - var onLeftOrRightInMenu = function (comp, se) { - var dropdown = Representing.getValue(comp); - Focusing.focus(dropdown); - emitWith(dropdown, 'keydown', { raw: se.event.raw }); - Dropdown.close(dropdown); - return Optional.some(true); - }; - var role = spec.role.fold(function () { - return {}; - }, function (role) { - return { role: role }; - }); - var tooltipAttributes = spec.tooltip.fold(function () { - return {}; - }, function (tooltip) { - var translatedTooltip = sharedBackstage.providers.translate(tooltip); - return { - 'title': translatedTooltip, - 'aria-label': translatedTooltip - }; - }); - var memDropdown = record(Dropdown.sketch(__assign(__assign(__assign({}, spec.uid ? { uid: spec.uid } : {}), role), { - dom: { - tag: 'button', - classes: [ - prefix, - prefix + '--select' - ].concat(map(spec.classes, function (c) { - return prefix + '--' + c; - })), - attributes: __assign({}, tooltipAttributes) - }, - components: componentRenderPipeline([ - optMemDisplayIcon.map(function (mem) { - return mem.asSpec(); - }), - optMemDisplayText.map(function (mem) { - return mem.asSpec(); - }), - Optional.some({ - dom: { - tag: 'div', - classes: [prefix + '__select-chevron'], - innerHtml: get$e('chevron-down', sharedBackstage.providers.icons) - } - }) - ]), - matchWidth: true, - useMinWidth: true, - dropdownBehaviours: derive$1(__spreadArrays(spec.dropdownBehaviours, [ - DisablingConfigs.button(function () { - return spec.disabled || sharedBackstage.providers.isDisabled(); - }), - receivingConfig(), - Unselecting.config({}), - Replacing.config({}), - config('dropdown-events', [ - onControlAttached(spec, editorOffCell), - onControlDetached(spec, editorOffCell) - ]), - config('menubutton-update-display-text', [ - run(updateMenuText, function (comp, se) { - optMemDisplayText.bind(function (mem) { - return mem.getOpt(comp); - }).each(function (displayText) { - Replacing.set(displayText, [text(sharedBackstage.providers.translate(se.event.text))]); - }); - }), - run(updateMenuIcon, function (comp, se) { - optMemDisplayIcon.bind(function (mem) { - return mem.getOpt(comp); - }).each(function (displayIcon) { - Replacing.set(displayIcon, [renderReplacableIconFromPack(se.event.icon, sharedBackstage.providers.icons)]); - }); - }) - ]) - ])), - eventOrder: deepMerge(toolbarButtonEventOrder, { - mousedown: [ - 'focusing', - 'alloy.base.behaviour', - 'item-type-events', - 'normal-dropdown-events' - ] - }), - sandboxBehaviours: derive$1([Keying.config({ - mode: 'special', - onLeft: onLeftOrRightInMenu, - onRight: onLeftOrRightInMenu - })]), - lazySink: sharedBackstage.getSink, - toggleClass: prefix + '--active', - parts: { menu: part(false, spec.columns, spec.presets) }, - fetch: function (comp) { - return Future.nu(curry(spec.fetch, comp)); - } - }))); - return memDropdown.asSpec(); - }; - - var isMenuItemReference = function (item) { - return isString(item); - }; - var isSeparator = function (item) { - return item.type === 'separator'; - }; - var isExpandingMenuItem = function (item) { - return has(item, 'getSubmenuItems'); - }; - var separator$1 = { type: 'separator' }; - var unwrapReferences = function (items, menuItems) { - var realItems = foldl(items, function (acc, item) { - if (isMenuItemReference(item)) { - if (item === '') { - return acc; - } else if (item === '|') { - return acc.length > 0 && !isSeparator(acc[acc.length - 1]) ? acc.concat([separator$1]) : acc; - } else if (has(menuItems, item.toLowerCase())) { - return acc.concat([menuItems[item.toLowerCase()]]); - } else { - return acc; - } - } else { - return acc.concat([item]); - } - }, []); - if (realItems.length > 0 && isSeparator(realItems[realItems.length - 1])) { - realItems.pop(); - } - return realItems; - }; - var getFromExpandingItem = function (item, menuItems) { - var submenuItems = item.getSubmenuItems(); - var rest = expand(submenuItems, menuItems); - var newMenus = deepMerge(rest.menus, wrap$1(item.value, rest.items)); - var newExpansions = deepMerge(rest.expansions, wrap$1(item.value, item.value)); - return { - item: item, - menus: newMenus, - expansions: newExpansions - }; - }; - var getFromItem = function (item, menuItems) { - return isExpandingMenuItem(item) ? getFromExpandingItem(item, menuItems) : { - item: item, - menus: {}, - expansions: {} - }; - }; - var generateValueIfRequired = function (item) { - if (isSeparator(item)) { - return item; - } else { - var itemValue = get$1(item, 'value').getOrThunk(function () { - return generate$1('generated-menu-item'); - }); - return deepMerge({ value: itemValue }, item); - } - }; - var expand = function (items, menuItems) { - var realItems = unwrapReferences(isString(items) ? items.split(' ') : items, menuItems); - return foldr(realItems, function (acc, item) { - var itemWithValue = generateValueIfRequired(item); - var newData = getFromItem(itemWithValue, menuItems); - return { - menus: deepMerge(acc.menus, newData.menus), - items: [newData.item].concat(acc.items), - expansions: deepMerge(acc.expansions, newData.expansions) - }; - }, { - menus: {}, - expansions: {}, - items: [] - }); - }; - - var build$2 = function (items, itemResponse, backstage, isHorizontalMenu) { - var primary = generate$1('primary-menu'); - var data = expand(items, backstage.shared.providers.menuItems()); - if (data.items.length === 0) { - return Optional.none(); - } - var mainMenu = createPartialMenu(primary, data.items, itemResponse, backstage, isHorizontalMenu); - var submenus = map$2(data.menus, function (menuItems, menuName) { - return createPartialMenu(menuName, menuItems, itemResponse, backstage, false); - }); - var menus = deepMerge(submenus, wrap$1(primary, mainMenu)); - return Optional.from(tieredMenu.tieredData(primary, menus, data.expansions)); - }; - - var getMenuButtonApi = function (component) { - return { - isDisabled: function () { - return Disabling.isDisabled(component); - }, - setDisabled: function (state) { - return Disabling.set(component, state); - }, - setActive: function (state) { - var elm = component.element; - if (state) { - add$2(elm, 'tox-tbtn--enabled'); - set$1(elm, 'aria-pressed', true); - } else { - remove$4(elm, 'tox-tbtn--enabled'); - remove$1(elm, 'aria-pressed'); - } - }, - isActive: function () { - return has$2(component.element, 'tox-tbtn--enabled'); - } - }; - }; - var renderMenuButton = function (spec, prefix, backstage, role) { - return renderCommonDropdown({ - text: spec.text, - icon: spec.icon, - tooltip: spec.tooltip, - role: role, - fetch: function (_comp, callback) { - spec.fetch(function (items) { - callback(build$2(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, false)); - }); - }, - onSetup: spec.onSetup, - getApi: getMenuButtonApi, - columns: 1, - presets: 'normal', - classes: [], - dropdownBehaviours: [Tabstopping.config({})] - }, prefix, backstage.shared); - }; - var getFetch$1 = function (items, getButton, backstage) { - var getMenuItemAction = function (item) { - return function (api) { - var newValue = !api.isActive(); - api.setActive(newValue); - item.storage.set(newValue); - backstage.shared.getSink().each(function (sink) { - getButton().getOpt(sink).each(function (orig) { - focus$1(orig.element); - emitWith(orig, formActionEvent, { - name: item.name, - value: item.storage.get() - }); - }); - }); - }; - }; - var getMenuItemSetup = function (item) { - return function (api) { - api.setActive(item.storage.get()); - }; - }; - return function (success) { - success(map(items, function (item) { - var text = item.text.fold(function () { - return {}; - }, function (text) { - return { text: text }; - }); - return __assign(__assign({ - type: item.type, - active: false - }, text), { - onAction: getMenuItemAction(item), - onSetup: getMenuItemSetup(item) - }); - })); - }; - }; - - var renderCommonSpec = function (spec, actionOpt, extraBehaviours, dom, components, providersBackstage) { - if (extraBehaviours === void 0) { - extraBehaviours = []; - } - var action = actionOpt.fold(function () { - return {}; - }, function (action) { - return { action: action }; - }); - var common = __assign({ - buttonBehaviours: derive$1([ - DisablingConfigs.button(function () { - return spec.disabled || providersBackstage.isDisabled(); - }), - receivingConfig(), - Tabstopping.config({}), - config('button press', [ - preventDefault('click'), - preventDefault('mousedown') - ]) - ].concat(extraBehaviours)), - eventOrder: { - click: [ - 'button press', - 'alloy.base.behaviour' - ], - mousedown: [ - 'button press', - 'alloy.base.behaviour' - ] - } - }, action); - var domFinal = deepMerge(common, { dom: dom }); - return deepMerge(domFinal, { components: components }); - }; - var renderIconButtonSpec = function (spec, action, providersBackstage, extraBehaviours) { - if (extraBehaviours === void 0) { - extraBehaviours = []; - } - var tooltipAttributes = spec.tooltip.map(function (tooltip) { - return { - 'aria-label': providersBackstage.translate(tooltip), - 'title': providersBackstage.translate(tooltip) - }; - }).getOr({}); - var dom = { - tag: 'button', - classes: ['tox-tbtn'], - attributes: tooltipAttributes - }; - var icon = spec.icon.map(function (iconName) { - return renderIconFromPack(iconName, providersBackstage.icons); - }); - var components = componentRenderPipeline([icon]); - return renderCommonSpec(spec, action, extraBehaviours, dom, components, providersBackstage); - }; - var renderIconButton = function (spec, action, providersBackstage, extraBehaviours) { - if (extraBehaviours === void 0) { - extraBehaviours = []; - } - var iconButtonSpec = renderIconButtonSpec(spec, Optional.some(action), providersBackstage, extraBehaviours); - return Button.sketch(iconButtonSpec); - }; - var renderButtonSpec = function (spec, action, providersBackstage, extraBehaviours, extraClasses) { - if (extraBehaviours === void 0) { - extraBehaviours = []; - } - if (extraClasses === void 0) { - extraClasses = []; - } - var translatedText = providersBackstage.translate(spec.text); - var icon = spec.icon ? spec.icon.map(function (iconName) { - return renderIconFromPack(iconName, providersBackstage.icons); - }) : Optional.none(); - var components = icon.isSome() ? componentRenderPipeline([icon]) : []; - var innerHtml = icon.isSome() ? {} : { innerHtml: translatedText }; - var classes = __spreadArrays(!spec.primary && !spec.borderless ? [ - 'tox-button', - 'tox-button--secondary' - ] : ['tox-button'], icon.isSome() ? ['tox-button--icon'] : [], spec.borderless ? ['tox-button--naked'] : [], extraClasses); - var dom = __assign(__assign({ - tag: 'button', - classes: classes - }, innerHtml), { attributes: { title: translatedText } }); - return renderCommonSpec(spec, action, extraBehaviours, dom, components, providersBackstage); - }; - var renderButton = function (spec, action, providersBackstage, extraBehaviours, extraClasses) { - if (extraBehaviours === void 0) { - extraBehaviours = []; - } - if (extraClasses === void 0) { - extraClasses = []; - } - var buttonSpec = renderButtonSpec(spec, Optional.some(action), providersBackstage, extraBehaviours, extraClasses); - return Button.sketch(buttonSpec); - }; - var getAction = function (name, buttonType) { - return function (comp) { - if (buttonType === 'custom') { - emitWith(comp, formActionEvent, { - name: name, - value: {} - }); - } else if (buttonType === 'submit') { - emit(comp, formSubmitEvent); - } else if (buttonType === 'cancel') { - emit(comp, formCancelEvent); - } else { - console.error('Unknown button type: ', buttonType); - } - }; - }; - var isMenuFooterButtonSpec = function (spec, buttonType) { - return buttonType === 'menu'; - }; - var isNormalFooterButtonSpec = function (spec, buttonType) { - return buttonType === 'custom' || buttonType === 'cancel' || buttonType === 'submit'; - }; - var renderFooterButton = function (spec, buttonType, backstage) { - if (isMenuFooterButtonSpec(spec, buttonType)) { - var getButton = function () { - return memButton_1; - }; - var menuButtonSpec = spec; - var fixedSpec = __assign(__assign({}, spec), { - onSetup: function (api) { - api.setDisabled(spec.disabled); - return noop; - }, - fetch: getFetch$1(menuButtonSpec.items, getButton, backstage) - }); - var memButton_1 = record(renderMenuButton(fixedSpec, 'tox-tbtn', backstage, Optional.none())); - return memButton_1.asSpec(); - } else if (isNormalFooterButtonSpec(spec, buttonType)) { - var action = getAction(spec.name, buttonType); - var buttonSpec = __assign(__assign({}, spec), { borderless: false }); - return renderButton(buttonSpec, action, backstage.shared.providers, []); - } else { - console.error('Unknown footer button type: ', buttonType); - } - }; - var renderDialogButton = function (spec, providersBackstage) { - var action = getAction(spec.name, 'custom'); - return renderFormField(Optional.none(), FormField.parts.field(__assign({ factory: Button }, renderButtonSpec(spec, Optional.some(action), providersBackstage, [ - RepresentingConfigs.memory(''), - ComposingConfigs.self() - ])))); - }; - - var schema$i = constant([ - defaulted$1('field1Name', 'field1'), - defaulted$1('field2Name', 'field2'), - onStrictHandler('onLockedChange'), - markers(['lockClass']), - defaulted$1('locked', false), - SketchBehaviours.field('coupledFieldBehaviours', [ - Composing, - Representing - ]) - ]); - var getField = function (comp, detail, partName) { - return getPart(comp, detail, partName).bind(Composing.getCurrent); - }; - var coupledPart = function (selfName, otherName) { - return required({ - factory: FormField, - name: selfName, - overrides: function (detail) { - return { - fieldBehaviours: derive$1([config('coupled-input-behaviour', [run(input(), function (me) { - getField(me, detail, otherName).each(function (other) { - getPart(me, detail, 'lock').each(function (lock) { - if (Toggling.isOn(lock)) { - detail.onLockedChange(me, other, lock); - } - }); - }); - })])]) - }; - } - }); - }; - var parts$5 = constant([ - coupledPart('field1', 'field2'), - coupledPart('field2', 'field1'), - required({ - factory: Button, - schema: [strict$1('dom')], - name: 'lock', - overrides: function (detail) { - return { - buttonBehaviours: derive$1([Toggling.config({ - selected: detail.locked, - toggleClass: detail.markers.lockClass, - aria: { mode: 'pressed' } - })]) - }; - } - }) - ]); - - var factory$7 = function (detail, components, _spec, _externals) { - return { - uid: detail.uid, - dom: detail.dom, - components: components, - behaviours: SketchBehaviours.augment(detail.coupledFieldBehaviours, [ - Composing.config({ find: Optional.some }), - Representing.config({ - store: { - mode: 'manual', - getValue: function (comp) { - var _a; - var parts = getPartsOrDie(comp, detail, [ - 'field1', - 'field2' - ]); - return _a = {}, _a[detail.field1Name] = Representing.getValue(parts.field1()), _a[detail.field2Name] = Representing.getValue(parts.field2()), _a; - }, - setValue: function (comp, value) { - var parts = getPartsOrDie(comp, detail, [ - 'field1', - 'field2' - ]); - if (hasNonNullableKey(value, detail.field1Name)) { - Representing.setValue(parts.field1(), value[detail.field1Name]); - } - if (hasNonNullableKey(value, detail.field2Name)) { - Representing.setValue(parts.field2(), value[detail.field2Name]); - } - } - } - }) - ]), - apis: { - getField1: function (component) { - return getPart(component, detail, 'field1'); - }, - getField2: function (component) { - return getPart(component, detail, 'field2'); - }, - getLock: function (component) { - return getPart(component, detail, 'lock'); - } - } - }; - }; - var FormCoupledInputs = composite$1({ - name: 'FormCoupledInputs', - configFields: schema$i(), - partFields: parts$5(), - factory: factory$7, - apis: { - getField1: function (apis, component) { - return apis.getField1(component); - }, - getField2: function (apis, component) { - return apis.getField2(component); - }, - getLock: function (apis, component) { - return apis.getLock(component); - } - } - }); - - var formatSize = function (size) { - var unitDec = { - '': 0, - 'px': 0, - 'pt': 1, - 'mm': 1, - 'pc': 2, - 'ex': 2, - 'em': 2, - 'ch': 2, - 'rem': 2, - 'cm': 3, - 'in': 4, - '%': 4 - }; - var maxDecimal = function (unit) { - return unit in unitDec ? unitDec[unit] : 1; - }; - var numText = size.value.toFixed(maxDecimal(size.unit)); - if (numText.indexOf('.') !== -1) { - numText = numText.replace(/\.?0*$/, ''); - } - return numText + size.unit; - }; - var parseSize = function (sizeText) { - var numPattern = /^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/; - var match = numPattern.exec(sizeText); - if (match !== null) { - var value = parseFloat(match[1]); - var unit = match[2]; - return Result.value({ - value: value, - unit: unit - }); - } else { - return Result.error(sizeText); - } - }; - var convertUnit = function (size, unit) { - var inInch = { - '': 96, - 'px': 96, - 'pt': 72, - 'cm': 2.54, - 'pc': 12, - 'mm': 25.4, - 'in': 1 - }; - var supported = function (u) { - return Object.prototype.hasOwnProperty.call(inInch, u); - }; - if (size.unit === unit) { - return Optional.some(size.value); - } else if (supported(size.unit) && supported(unit)) { - if (inInch[size.unit] === inInch[unit]) { - return Optional.some(size.value); - } else { - return Optional.some(size.value / inInch[size.unit] * inInch[unit]); - } - } else { - return Optional.none(); - } - }; - var noSizeConversion = function (_input) { - return Optional.none(); - }; - var ratioSizeConversion = function (scale, unit) { - return function (size) { - return convertUnit(size, unit).map(function (value) { - return { - value: value * scale, - unit: unit - }; - }); - }; - }; - var makeRatioConverter = function (currentFieldText, otherFieldText) { - var cValue = parseSize(currentFieldText).toOptional(); - var oValue = parseSize(otherFieldText).toOptional(); - return lift2(cValue, oValue, function (cSize, oSize) { - return convertUnit(cSize, oSize.unit).map(function (val) { - return oSize.value / val; - }).map(function (r) { - return ratioSizeConversion(r, oSize.unit); - }).getOr(noSizeConversion); - }).getOr(noSizeConversion); - }; - - var renderSizeInput = function (spec, providersBackstage) { - var converter = noSizeConversion; - var ratioEvent = generate$1('ratio-event'); - var pLock = FormCoupledInputs.parts.lock({ - dom: { - tag: 'button', - classes: [ - 'tox-lock', - 'tox-button', - 'tox-button--naked', - 'tox-button--icon' - ], - attributes: { title: providersBackstage.translate(spec.label.getOr('Constrain proportions')) } - }, - components: [ - { - dom: { - tag: 'span', - classes: [ - 'tox-icon', - 'tox-lock-icon__lock' - ], - innerHtml: get$e('lock', providersBackstage.icons) - } - }, - { - dom: { - tag: 'span', - classes: [ - 'tox-icon', - 'tox-lock-icon__unlock' - ], - innerHtml: get$e('unlock', providersBackstage.icons) - } - } - ], - buttonBehaviours: derive$1([ - Disabling.config({ - disabled: function () { - return spec.disabled || providersBackstage.isDisabled(); - } - }), - receivingConfig(), - Tabstopping.config({}) - ]) - }); - var formGroup = function (components) { - return { - dom: { - tag: 'div', - classes: ['tox-form__group'] - }, - components: components - }; - }; - var getFieldPart = function (isField1) { - return FormField.parts.field({ - factory: Input, - inputClasses: ['tox-textfield'], - inputBehaviours: derive$1([ - Disabling.config({ - disabled: function () { - return spec.disabled || providersBackstage.isDisabled(); - } - }), - receivingConfig(), - Tabstopping.config({}), - config('size-input-events', [ - run(focusin(), function (component, _simulatedEvent) { - emitWith(component, ratioEvent, { isField1: isField1 }); - }), - run(change(), function (component, _simulatedEvent) { - emitWith(component, formChangeEvent, { name: spec.name }); - }) - ]) - ]), - selectOnFocus: false - }); - }; - var getLabel = function (label) { - return { - dom: { - tag: 'label', - classes: ['tox-label'], - innerHtml: providersBackstage.translate(label) - } - }; - }; - var widthField = FormCoupledInputs.parts.field1(formGroup([ - FormField.parts.label(getLabel('Width')), - getFieldPart(true) - ])); - var heightField = FormCoupledInputs.parts.field2(formGroup([ - FormField.parts.label(getLabel('Height')), - getFieldPart(false) - ])); - return FormCoupledInputs.sketch({ - dom: { - tag: 'div', - classes: ['tox-form__group'] - }, - components: [{ - dom: { - tag: 'div', - classes: ['tox-form__controls-h-stack'] - }, - components: [ - widthField, - heightField, - formGroup([ - getLabel(' '), - pLock - ]) - ] - }], - field1Name: 'width', - field2Name: 'height', - locked: true, - markers: { lockClass: 'tox-locked' }, - onLockedChange: function (current, other, _lock) { - parseSize(Representing.getValue(current)).each(function (size) { - converter(size).each(function (newSize) { - Representing.setValue(other, formatSize(newSize)); - }); - }); - }, - coupledFieldBehaviours: derive$1([ - Disabling.config({ - disabled: function () { - return spec.disabled || providersBackstage.isDisabled(); - }, - onDisabled: function (comp) { - FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.disable); - FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.disable); - FormCoupledInputs.getLock(comp).each(Disabling.disable); - }, - onEnabled: function (comp) { - FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.enable); - FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.enable); - FormCoupledInputs.getLock(comp).each(Disabling.enable); - } - }), - receivingConfig(), - config('size-input-events2', [run(ratioEvent, function (component, simulatedEvent) { - var isField1 = simulatedEvent.event.isField1; - var optCurrent = isField1 ? FormCoupledInputs.getField1(component) : FormCoupledInputs.getField2(component); - var optOther = isField1 ? FormCoupledInputs.getField2(component) : FormCoupledInputs.getField1(component); - var value1 = optCurrent.map(Representing.getValue).getOr(''); - var value2 = optOther.map(Representing.getValue).getOr(''); - converter = makeRatioConverter(value1, value2); - })]) - ]) - }); - }; - - var undo = constant(generate$1('undo')); - var redo = constant(generate$1('redo')); - var zoom = constant(generate$1('zoom')); - var back = constant(generate$1('back')); - var apply = constant(generate$1('apply')); - var swap = constant(generate$1('swap')); - var transform = constant(generate$1('transform')); - var tempTransform = constant(generate$1('temp-transform')); - var transformApply = constant(generate$1('transform-apply')); - var internal = { - undo: undo, - redo: redo, - zoom: zoom, - back: back, - apply: apply, - swap: swap, - transform: transform, - tempTransform: tempTransform, - transformApply: transformApply - }; - var saveState = constant('save-state'); - var disable$1 = constant('disable'); - var enable$1 = constant('enable'); - var external$2 = { - formActionEvent: formActionEvent, - saveState: saveState, - disable: disable$1, - enable: enable$1 - }; - - var renderEditPanel = function (imagePanel, providersBackstage) { - var createButton = function (text, action, disabled, primary) { - return record(renderButton({ - name: text, - text: text, - disabled: disabled, - primary: primary, - icon: Optional.none(), - borderless: false - }, action, providersBackstage)); - }; - var createIconButton = function (icon, tooltip, action, disabled) { - return record(renderIconButton({ - name: icon, - icon: Optional.some(icon), - tooltip: Optional.some(tooltip), - disabled: disabled, - primary: false, - borderless: false - }, action, providersBackstage)); - }; - var disableAllComponents = function (comps, eventcomp) { - comps.map(function (mem) { - var component = mem.get(eventcomp); - if (component.hasConfigured(Disabling)) { - Disabling.disable(component); - } - }); - }; - var enableAllComponents = function (comps, eventcomp) { - comps.map(function (mem) { - var component = mem.get(eventcomp); - if (component.hasConfigured(Disabling)) { - Disabling.enable(component); - } - }); - }; - var panelDom = { - tag: 'div', - classes: [ - 'tox-image-tools__toolbar', - 'tox-image-tools-edit-panel' - ] - }; - var noop$1 = noop; - var emit$1 = function (comp, event, data) { - emitWith(comp, event, data); - }; - var emitDisable = function (component) { - return emit(component, external$2.disable()); - }; - var emitEnable = function (component) { - return emit(component, external$2.enable()); - }; - var emitTransform = function (comp, transform) { - emitDisable(comp); - emit$1(comp, internal.transform(), { transform: transform }); - emitEnable(comp); - }; - var emitTempTransform = function (comp, transform) { - emitDisable(comp); - emit$1(comp, internal.tempTransform(), { transform: transform }); - emitEnable(comp); - }; - var getBackSwap = function (anyInSystem) { - return function () { - memContainer.getOpt(anyInSystem).each(function (container) { - Replacing.set(container, [ButtonPanel]); - }); - }; - }; - var emitTransformApply = function (comp, transform) { - emitDisable(comp); - emit$1(comp, internal.transformApply(), { - transform: transform, - swap: getBackSwap(comp) - }); - emitEnable(comp); - }; - var createBackButton = function () { - return createButton('Back', function (button) { - return emit$1(button, internal.back(), { swap: getBackSwap(button) }); - }, false, false); - }; - var createSpacer = function () { - return record({ - dom: { - tag: 'div', - classes: ['tox-spacer'] - }, - behaviours: derive$1([Disabling.config({})]) - }); - }; - var createApplyButton = function () { - return createButton('Apply', function (button) { - return emit$1(button, internal.apply(), { swap: getBackSwap(button) }); - }, true, true); - }; - var makeCropTransform = function () { - return function (ir) { - var rect = imagePanel.getRect(); - return crop$1(ir, rect.x, rect.y, rect.w, rect.h); - }; - }; - var cropPanelComponents = [ - createBackButton(), - createSpacer(), - createButton('Apply', function (button) { - var transform = makeCropTransform(); - emitTransformApply(button, transform); - imagePanel.hideCrop(); - }, false, true) - ]; - var CropPanel = Container.sketch({ - dom: panelDom, - components: cropPanelComponents.map(function (mem) { - return mem.asSpec(); - }), - containerBehaviours: derive$1([config('image-tools-crop-buttons-events', [ - run(external$2.disable(), function (comp, _se) { - disableAllComponents(cropPanelComponents, comp); - }), - run(external$2.enable(), function (comp, _se) { - enableAllComponents(cropPanelComponents, comp); - }) - ])]) - }); - var memSize = record(renderSizeInput({ - name: 'size', - label: Optional.none(), - constrain: true, - disabled: false - }, providersBackstage)); - var makeResizeTransform = function (width, height) { - return function (ir) { - return resize$2(ir, width, height); - }; - }; - var resizePanelComponents = [ - createBackButton(), - createSpacer(), - memSize, - createSpacer(), - createButton('Apply', function (button) { - memSize.getOpt(button).each(function (sizeInput) { - var value = Representing.getValue(sizeInput); - var width = parseInt(value.width, 10); - var height = parseInt(value.height, 10); - var transform = makeResizeTransform(width, height); - emitTransformApply(button, transform); - }); - }, false, true) - ]; - var ResizePanel = Container.sketch({ - dom: panelDom, - components: resizePanelComponents.map(function (mem) { - return mem.asSpec(); - }), - containerBehaviours: derive$1([config('image-tools-resize-buttons-events', [ - run(external$2.disable(), function (comp, _se) { - disableAllComponents(resizePanelComponents, comp); - }), - run(external$2.enable(), function (comp, _se) { - enableAllComponents(resizePanelComponents, comp); - }) - ])]) - }); - var makeValueTransform = function (transform, value) { - return function (ir) { - return transform(ir, value); - }; - }; - var horizontalFlip = makeValueTransform(flip$1, 'h'); - var verticalFlip = makeValueTransform(flip$1, 'v'); - var counterclockwiseRotate = makeValueTransform(rotate$1, -90); - var clockwiseRotate = makeValueTransform(rotate$1, 90); - var flipRotateOnAction = function (comp, operation) { - emitTempTransform(comp, operation); - }; - var flipRotateComponents = [ - createBackButton(), - createSpacer(), - createIconButton('flip-horizontally', 'Flip horizontally', function (button) { - flipRotateOnAction(button, horizontalFlip); - }, false), - createIconButton('flip-vertically', 'Flip vertically', function (button) { - flipRotateOnAction(button, verticalFlip); - }, false), - createIconButton('rotate-left', 'Rotate counterclockwise', function (button) { - flipRotateOnAction(button, counterclockwiseRotate); - }, false), - createIconButton('rotate-right', 'Rotate clockwise', function (button) { - flipRotateOnAction(button, clockwiseRotate); - }, false), - createSpacer(), - createApplyButton() - ]; - var FlipRotatePanel = Container.sketch({ - dom: panelDom, - components: flipRotateComponents.map(function (mem) { - return mem.asSpec(); - }), - containerBehaviours: derive$1([config('image-tools-fliprotate-buttons-events', [ - run(external$2.disable(), function (comp, _se) { - disableAllComponents(flipRotateComponents, comp); - }), - run(external$2.enable(), function (comp, _se) { - enableAllComponents(flipRotateComponents, comp); - }) - ])]) - }); - var makeSlider = function (label, onChoose, min, value, max) { - var labelPart = Slider.parts.label({ - dom: { - tag: 'label', - classes: ['tox-label'], - innerHtml: providersBackstage.translate(label) - } - }); - var spectrum = Slider.parts.spectrum({ - dom: { - tag: 'div', - classes: ['tox-slider__rail'], - attributes: { role: 'presentation' } - } - }); - var thumb = Slider.parts.thumb({ - dom: { - tag: 'div', - classes: ['tox-slider__handle'], - attributes: { role: 'presentation' } - } - }); - return record(Slider.sketch({ - dom: { - tag: 'div', - classes: ['tox-slider'], - attributes: { role: 'presentation' } - }, - model: { - mode: 'x', - minX: min, - maxX: max, - getInitialValue: constant({ x: value }) - }, - components: [ - labelPart, - spectrum, - thumb - ], - sliderBehaviours: derive$1([Focusing.config({})]), - onChoose: onChoose - })); - }; - var makeVariableSlider = function (label, transform, min, value, max) { - var onChoose = function (slider, _thumb, value) { - var valTransform = makeValueTransform(transform, value.x / 100); - emitTransform(slider, valTransform); - }; - return makeSlider(label, onChoose, min, value, max); - }; - var variableFilterPanelComponents = function (label, transform, min, value, max) { - return [ - createBackButton(), - makeVariableSlider(label, transform, min, value, max), - createApplyButton() - ]; - }; - var createVariableFilterPanel = function (label, transform, min, value, max) { - var filterPanelComponents = variableFilterPanelComponents(label, transform, min, value, max); - return Container.sketch({ - dom: panelDom, - components: filterPanelComponents.map(function (mem) { - return mem.asSpec(); - }), - containerBehaviours: derive$1([config('image-tools-filter-panel-buttons-events', [ - run(external$2.disable(), function (comp, _se) { - disableAllComponents(filterPanelComponents, comp); - }), - run(external$2.enable(), function (comp, _se) { - enableAllComponents(filterPanelComponents, comp); - }) - ])]) - }); - }; - var filterPanelComponents = [ - createBackButton(), - createSpacer(), - createApplyButton() - ]; - var FilterPanel = Container.sketch({ - dom: panelDom, - components: filterPanelComponents.map(function (mem) { - return mem.asSpec(); - }) - }); - var BrightnessPanel = createVariableFilterPanel('Brightness', brightness$1, -100, 0, 100); - var ContrastPanel = createVariableFilterPanel('Contrast', contrast$1, -100, 0, 100); - var GammaPanel = createVariableFilterPanel('Gamma', gamma$1, -100, 0, 100); - var makeColorTransform = function (red, green, blue) { - return function (ir) { - return colorize$1(ir, red, green, blue); - }; - }; - var makeColorSlider = function (label) { - var onChoose = function (slider, _thumb, _value) { - var redOpt = memRed.getOpt(slider); - var blueOpt = memBlue.getOpt(slider); - var greenOpt = memGreen.getOpt(slider); - redOpt.each(function (red) { - blueOpt.each(function (blue) { - greenOpt.each(function (green) { - var r = Representing.getValue(red).x / 100; - var g = Representing.getValue(green).x / 100; - var b = Representing.getValue(blue).x / 100; - var transform = makeColorTransform(r, g, b); - emitTransform(slider, transform); - }); - }); - }); - }; - return makeSlider(label, onChoose, 0, 100, 200); - }; - var memRed = makeColorSlider('R'); - var memGreen = makeColorSlider('G'); - var memBlue = makeColorSlider('B'); - var colorizePanelComponents = [ - createBackButton(), - memRed, - memGreen, - memBlue, - createApplyButton() - ]; - var ColorizePanel = Container.sketch({ - dom: panelDom, - components: colorizePanelComponents.map(function (mem) { - return mem.asSpec(); - }) - }); - var getTransformPanelEvent = function (panel, transform, update) { - return function (button) { - var swap = function () { - memContainer.getOpt(button).each(function (container) { - Replacing.set(container, [panel]); - update(container); - }); - }; - emit$1(button, internal.swap(), { - transform: transform, - swap: swap - }); - }; - }; - var cropPanelUpdate = function (_anyInSystem) { - imagePanel.showCrop(); - }; - var resizePanelUpdate = function (anyInSystem) { - memSize.getOpt(anyInSystem).each(function (sizeInput) { - var measurements = imagePanel.getMeasurements(); - var width = measurements.width; - var height = measurements.height; - Representing.setValue(sizeInput, { - width: width, - height: height - }); - }); - }; - var sharpenTransform = Optional.some(sharpen$1); - var invertTransform = Optional.some(invert$1); - var buttonPanelComponents = [ - createIconButton('crop', 'Crop', getTransformPanelEvent(CropPanel, Optional.none(), cropPanelUpdate), false), - createIconButton('resize', 'Resize', getTransformPanelEvent(ResizePanel, Optional.none(), resizePanelUpdate), false), - createIconButton('orientation', 'Orientation', getTransformPanelEvent(FlipRotatePanel, Optional.none(), noop$1), false), - createIconButton('brightness', 'Brightness', getTransformPanelEvent(BrightnessPanel, Optional.none(), noop$1), false), - createIconButton('sharpen', 'Sharpen', getTransformPanelEvent(FilterPanel, sharpenTransform, noop$1), false), - createIconButton('contrast', 'Contrast', getTransformPanelEvent(ContrastPanel, Optional.none(), noop$1), false), - createIconButton('color-levels', 'Color levels', getTransformPanelEvent(ColorizePanel, Optional.none(), noop$1), false), - createIconButton('gamma', 'Gamma', getTransformPanelEvent(GammaPanel, Optional.none(), noop$1), false), - createIconButton('invert', 'Invert', getTransformPanelEvent(FilterPanel, invertTransform, noop$1), false) - ]; - var ButtonPanel = Container.sketch({ - dom: panelDom, - components: buttonPanelComponents.map(function (mem) { - return mem.asSpec(); - }) - }); - var container = Container.sketch({ - dom: { tag: 'div' }, - components: [ButtonPanel], - containerBehaviours: derive$1([Replacing.config({})]) - }); - var memContainer = record(container); - var getApplyButton = function (anyInSystem) { - return memContainer.getOpt(anyInSystem).map(function (container) { - var panel = container.components()[0]; - return panel.components()[panel.components().length - 1]; - }); - }; - return { - memContainer: memContainer, - getApplyButton: getApplyButton - }; - }; - - var global$d = tinymce.util.Tools.resolve('tinymce.geom.Rect'); - - var global$e = tinymce.util.Tools.resolve('tinymce.dom.DomQuery'); - - var global$f = tinymce.util.Tools.resolve('tinymce.util.Observable'); - - var global$g = tinymce.util.Tools.resolve('tinymce.util.VK'); - - var getDocumentSize = function (doc) { - var max = Math.max; - var documentElement = doc.documentElement; - var body = doc.body; - var scrollWidth = max(documentElement.scrollWidth, body.scrollWidth); - var clientWidth = max(documentElement.clientWidth, body.clientWidth); - var offsetWidth = max(documentElement.offsetWidth, body.offsetWidth); - var scrollHeight = max(documentElement.scrollHeight, body.scrollHeight); - var clientHeight = max(documentElement.clientHeight, body.clientHeight); - var offsetHeight = max(documentElement.offsetHeight, body.offsetHeight); - return { - width: scrollWidth < offsetWidth ? clientWidth : scrollWidth, - height: scrollHeight < offsetHeight ? clientHeight : scrollHeight - }; - }; - var updateWithTouchData = function (e) { - var keys, i; - if (e.changedTouches) { - keys = 'screenX screenY pageX pageY clientX clientY'.split(' '); - for (i = 0; i < keys.length; i++) { - e[keys[i]] = e.changedTouches[0][keys[i]]; - } - } - }; - function DragHelper (id, settings) { - var $eventOverlay; - var doc = settings.document || document; - var downButton; - var startX, startY; - var handleElement = doc.getElementById(settings.handle || id); - var start = function (e) { - var docSize = getDocumentSize(doc); - var cursor; - updateWithTouchData(e); - e.preventDefault(); - downButton = e.button; - var handleElm = handleElement; - startX = e.screenX; - startY = e.screenY; - if (window.getComputedStyle) { - cursor = window.getComputedStyle(handleElm, null).getPropertyValue('cursor'); - } else { - cursor = handleElm.runtimeStyle.cursor; - } - $eventOverlay = global$e('
').css({ - position: 'absolute', - top: 0, - left: 0, - width: docSize.width, - height: docSize.height, - zIndex: 2147483647, - opacity: 0.0001, - cursor: cursor - }).appendTo(doc.body); - global$e(doc).on('mousemove touchmove', drag).on('mouseup touchend', stop); - settings.start(e); - }; - var drag = function (e) { - updateWithTouchData(e); - if (e.button !== downButton) { - return stop(e); - } - e.deltaX = e.screenX - startX; - e.deltaY = e.screenY - startY; - e.preventDefault(); - settings.drag(e); - }; - var stop = function (e) { - updateWithTouchData(e); - global$e(doc).off('mousemove touchmove', drag).off('mouseup touchend', stop); - $eventOverlay.remove(); - if (settings.stop) { - settings.stop(e); - } - }; - var destroy = function () { - global$e(handleElement).off(); - }; - global$e(handleElement).on('mousedown touchstart', start); - return { destroy: destroy }; - } - - var count = 0; - var create$7 = function (currentRect, viewPortRect, clampRect, containerElm, action) { - var dragHelpers; - var prefix = 'tox-'; - var id = prefix + 'crid-' + count++; - var handles = [ - { - name: 'move', - xMul: 0, - yMul: 0, - deltaX: 1, - deltaY: 1, - deltaW: 0, - deltaH: 0, - label: 'Crop Mask' - }, - { - name: 'nw', - xMul: 0, - yMul: 0, - deltaX: 1, - deltaY: 1, - deltaW: -1, - deltaH: -1, - label: 'Top Left Crop Handle' - }, - { - name: 'ne', - xMul: 1, - yMul: 0, - deltaX: 0, - deltaY: 1, - deltaW: 1, - deltaH: -1, - label: 'Top Right Crop Handle' - }, - { - name: 'sw', - xMul: 0, - yMul: 1, - deltaX: 1, - deltaY: 0, - deltaW: -1, - deltaH: 1, - label: 'Bottom Left Crop Handle' - }, - { - name: 'se', - xMul: 1, - yMul: 1, - deltaX: 0, - deltaY: 0, - deltaW: 1, - deltaH: 1, - label: 'Bottom Right Crop Handle' - } - ]; - var blockers = [ - 'top', - 'right', - 'bottom', - 'left' - ]; - var getAbsoluteRect = function (outerRect, relativeRect) { - return { - x: relativeRect.x + outerRect.x, - y: relativeRect.y + outerRect.y, - w: relativeRect.w, - h: relativeRect.h - }; - }; - var getRelativeRect = function (outerRect, innerRect) { - return { - x: innerRect.x - outerRect.x, - y: innerRect.y - outerRect.y, - w: innerRect.w, - h: innerRect.h - }; - }; - var getInnerRect = function () { - return getRelativeRect(clampRect, currentRect); - }; - var moveRect = function (handle, startRect, deltaX, deltaY) { - var x, y, w, h, rect; - x = startRect.x; - y = startRect.y; - w = startRect.w; - h = startRect.h; - x += deltaX * handle.deltaX; - y += deltaY * handle.deltaY; - w += deltaX * handle.deltaW; - h += deltaY * handle.deltaH; - if (w < 20) { - w = 20; - } - if (h < 20) { - h = 20; - } - rect = currentRect = global$d.clamp({ - x: x, - y: y, - w: w, - h: h - }, clampRect, handle.name === 'move'); - rect = getRelativeRect(clampRect, rect); - instance.fire('updateRect', { rect: rect }); - setInnerRect(rect); - }; - var render = function () { - var createDragHelper = function (handle) { - var startRect; - return DragHelper(id, { - document: containerElm.ownerDocument, - handle: id + '-' + handle.name, - start: function () { - startRect = currentRect; - }, - drag: function (e) { - moveRect(handle, startRect, e.deltaX, e.deltaY); - } - }); - }; - global$e('
').appendTo(containerElm); - global$c.each(blockers, function (blocker) { - global$e('#' + id, containerElm).append('