We've moved discussions to Discord

JavaScript error with Ruby 3.1 and latest commit

Benjamin Houy
Hi,

I recently merged the latest Jumpstart commits and updated to Ruby 3.1 but I can't get the JavaScript to work in production (everything works in development.)

I see nothing in the Rails or server logs but the JS console shows the following for application.js:
Uncaught SyntaxError: invalid escape sequence
Then this part is highlighted in the JS console:
%o`,e,t,i),(r=window.onerror)===null||r===void 0||r.call(window,e,"",0,0,t)}logFormattedMessage(t,e,i={}){i=Object.assign({application:this},i),this.logger.groupCollapsed(`${t} #${e}`),this.logger.log("details:",Object.assign({},i)),this.logger.groupEnd()}};function Vf(){return new Promise(n=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>n()):n()})}function Uf(n){return _s(n,"classes").reduce((e,i)=>Object.assign(e,Gf(i)),{})}function Gf(n){return{[`${n}Class`]:{get(){let{classes:t}=this;if(t.has(n))return t.get(n);{let e=t.getAttributeName(n);throw new Error(`Missing attribute "${e}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${Rr(n)}Class`]:{get(){return this.classes.has(n)}}}}function zf(n){return _s(n,"targets").reduce((e,i)=>Object.assign(e,qf(i)),{})}function qf(n){return{[`${n}Target`]:{get(){let t=this.targets.find(n);if(t)return t;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${Rr(n)}Target`]:{get(){return this.targets.has(n)}}}}function Yf(n){let t=Lf(n,"values"),e={valueDescriptorMap:{get(){return t.reduce((i,r)=>{let o=_c(r),l=this.data.getAttributeNameForKey(o.key);return Object.assign(i,{[l]:o})},{})}}};return t.reduce((i,r)=>Object.assign(i,Kf(r)),e)}function Kf(n){let t=_c(n),{key:e,name:i,reader:r,writer:o}=t;return{[i]:{get(){let l=this.data.get(e);return l!==null?r(l):t.defaultValue},set(l){l===void 0?this.data.delete(e):this.data.set(e,o(l))}},[`has${Rr(i)}`]:{get(){return this.data.has(e)||t.hasCustomDefaultValue}}}}function _c([n,t]){return Jf(n,t)}function Cs(n){switch(n){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function Ss(n){switch(typeof n){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(n))return"array";if(Object.prototype.toString.call(n)==="[object Object]")return"object"}function Xf(n){let t=Cs(n.type);if(t){let e=Ss(n.default);if(t!==e)throw new Error(`Type "${t}" must match the type of the default value. Given default value: "${n.default}" as "${e}"`);return t}}function $f(n){let t=Xf(n),e=Ss(n),i=Cs(n),r=t||e||i;if(r)return r;throw new Error(`Unknown value type "${n}"`)}function Zf(n){let t=Cs(n);if(t)return Qf[t];let e=n.default;return e!==void 0?e:n}function Jf(n,t){let e=`${ec(n)}-value`,i=$f(t);return{type:i,key:e,name:tc(e),get defaultValue(){return Zf(t)},get hasCustomDefaultValue(){return Ss(t)!==void 0},reader:tp[i],writer:$l[i]||$l.default}}var Qf={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},tp={array(n){let t=JSON.parse(n);if(!Array.isArray(t))throw new TypeError("Expected array");return t},boolean(n){return!(n=="0"||n=="false")},number(n){return Number(n)},object(n){let t=JSON.parse(n);if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError("Expected object");return t},string(n){return n}},$l={default:ep,array:Zl,object:Zl};function Zl(n){return JSON.stringify(n)}function ep(n){return`${n}`}var ut=class{constructor(t){this.context=t}static get shouldLoad(){return!0}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:i={},prefix:r=this.identifier,bubbles:o=!0,cancelable:l=!0}={}){let a=r?`${r}:${t}`:t,h=new CustomEvent(a,{detail:i,bubbles:o,cancelable:l});return e.dispatchEvent(h),h}};ut.blessings=[Uf,zf,Yf];ut.targets=[];ut.values={};var Me=Mi.start();Me.debug=!1;window.Stimulus=Me;var As={};re(As,{default:()=>Dc});var Br={logger:self.console,WebSocket:self.WebSocket},It={log(...n){this.enabled&&(n.push(Date.now()),Br.logger.log("[ActionCable]",...n))}},Ri=()=>new Date().getTime(),Fr=n=>(Ri()-n)/1e3,Wr=class{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=Ri(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),It.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=Ri(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),It.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordPing(){this.pingedAt=Ri()}recordConnect(){this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,It.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=Ri(),It.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll()},this.getPollInterval())}getPollInterval(){let{staleThreshold:t,reconnectionBackoffRate:e}=this.constructor,i=Math.pow(1+e,Math.min(this.reconnectAttempts,10)),o=(this.reconnectAttempts===0?1:e)*Math.random();return t*1e3*i*(1+o)}reconnectIfStale(){this.connectionIsStale()&&(It.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${Fr(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?It.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${Fr(this.disconnectedAt)} s`):(It.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return Fr(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&Fr(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout(()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(It.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())},200)}};Wr.staleThreshold=6;Wr.reconnectionBackoffRate=.15;var Sc={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},{message_types:Ii,protocols:Hr}=Sc,np=Hr.slice(0,Hr.length-1),Cc=[].indexOf,jr=class{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new Wr(this),this.disconnected=!0}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){return this.isActive()?(It.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1):(It.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${Hr}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new Br.WebSocket(this.consumer.url,Hr),this.installEventHandlers(),this.monitor.start(),!0)}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isActive())return this.webSocket.close()}reopen(){if(It.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){It.log("Failed to reopen WebSocket",t)}finally{It.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}isProtocolSupported(){return Cc.call(np,this.getProtocol())>=0}isState(...t){return Cc.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in Br.WebSocket)if(Br.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){let e=this.events[t].bind(this);this.webSocket[`on${t}`]=e}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){}}};jr.reopenDelay=500;jr.prototype.events={message(n){if(!this.isProtocolSupported())return;let{identifier:t,message:e,reason:i,reconnect:r,type:o}=JSON.parse(n.data);switch(o){case Ii.welcome:return this.monitor.recordConnect(),this.subscriptions.reload();case Ii.disconnect:return It.log(`Disconnecting. Reason: ${i}`),this.close({allowReconnect:r});case Ii.ping:return this.monitor.recordPing();case Ii.confirmation:return this.subscriptions.confirmSubscription(t),this.subscriptions.notify(t,"connected");case Ii.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",e)}},open(){if(It.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return It.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(n){if(It.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){It.log("WebSocket onerror event")}};var ip=function(n,t){if(t!=null)for(let e in t){let i=t[e];n[e]=i}return n},Ac=class{constructor(t,e={},i){this.consumer=t,this.identifier=JSON.stringify(e),ip(this,i)}perform(t,e={}){return e.action=t,this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}},Ec=class{constructor(t){this.subscriptions=t,this.pendingSubscriptions=[]}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(It.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):It.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing()}forget(t){It.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(e=>e!==t)}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(t=>{It.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t)})},500)}},Tc=class{constructor(t){this.consumer=t,this.guarantor=new Ec(this),this.subscriptions=[]}create(t,e){let i=t,r=typeof i=="object"?i:{channel:i},o=new Ac(this.consumer,r,e);return this.add(o)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.subscribe(t),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map(e=>(this.forget(e),this.notify(e,"rejected"),e))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter(e=>e!==t),t}findAll(t){return this.subscriptions.filter(e=>e.identifier===t)}reload(){return this.subscriptions.map(t=>this.subscribe(t))}notifyAll(t,...e){return this.subscriptions.map(i=>this.notify(i,t,...e))}notify(t,e,...i){let r;return typeof t=="string"?r=this.findAll(t):r=[t],r.map(o=>typeof o[e]=="function"?o[e](...i):void 0)}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t)}confirmSubscription(t){It.log(`Subscription confirmed ${t}`),this.findAll(t).map(e=>this.guarantor.forget(e))}sendCommand(t,e){let{identifier:i}=t;return this.consumer.send({command:e,identifier:i})}},xc=class{constructor(t){this._url=t,this.subscriptions=new Tc(this),this.connection=new jr(this)}get url(){return rp(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}};function rp(n){if(typeof n=="function"&&(n=n()),n&&!/^wss?:/i.test(n)){let t=document.createElement("a");return t.href=n,t.href=t.href,t.protocol=t.protocol.replace("http","ws"),t.href}else return n}function kc(n=op("url")||Sc.default_mount_path){return new xc(n)}function op(n){let t=document.head.querySelector(`meta[name='action-cable-${n}']`);if(t)return t.getAttribute("content")}var Ni=kc();var Dc=class extends ut{reconnect(n){Ni.connection.isActive()&&Ni.connection.reopen()}};var Ts={};re(Ts,{default:()=>Es});var Es=class extends ut{connect(){braintree.dropin.create({authorization:this.data.get("clientToken"),container:this.dropinTarget,paypal:{flow:"vault"}},this.clientCreated.bind(this))}clientCreated(n,t){if(n){console.error("Error setting up Braintree dropin:",n);return}this.instance=t}submit(n){n.preventDefault(),this.instance.requestPaymentMethod(this.paymentMethod.bind(this))}paymentMethod(n,t){if(n){console.error("Error with payment method:",n);return}this.addHiddenField("processor","braintree"),this.addHiddenField("payment_method_token",t.nonce),Rails.fire(this.formTarget,"submit")}addHiddenField(n,t){let e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name",n),e.setAttribute("value",t),this.formTarget.appendChild(e)}};Wt(Es,"targets",["dropin","form"]);var ks={};re(ks,{default:()=>xs});var xs=class extends ut{toggleSelectAll(n){this.allCheckboxesSelected?this.unselectAll():this.selectAll()}selectAll(){this.selectAllTarget.checked=!0,this.selectAllTarget.indeterminate=!1,this.unselected.forEach(n=>n.checked=!0)}unselectAll(){this.selectAllTarget.checked=!1,this.selectAllTarget.indeterminate=!1,this.selected.forEach(n=>n.checked=!1)}change(n){this.noCheckboxesSelected?(this.selectAllTarget.checked=!1,this.selectAllTarget.indeterminate=!1):this.allCheckboxesSelected?(this.selectAllTarget.checked=!0,this.selectAllTarget.indeterminate=!1):this.selectAllTarget.indeterminate=!0}get selectedAll(){return this.selectAllTarget.checked}get selected(){return this.checkboxTargets.filter(n=>n.checked)}get unselected(){return this.checkboxTargets.filter(n=>!n.checked)}get selectedIds(){return this.selected.map(n=>n.dataset.id)}get allCheckboxesSelected(){return this.checkboxTargets.every(n=>n.checked)}get noCheckboxesSelected(){return this.checkboxTargets.every(n=>!n.checked)}};Wt(xs,"targets",["checkbox","selectAll"]);var Js={};re(Js,{default:()=>Zs});var pu=qe(Lc());var Bt="top",qt="bottom",Ut="right",jt="left",Vr="auto",mn=[Bt,qt,Ut,jt],nn="start",Dn="end",Pc="clippingParents",Ur="viewport",ri="popper",Oc="reference",Ls=mn.reduce(function(n,t){return n.concat([t+"-"+nn,t+"-"+Dn])},[]),Gr=[].concat(mn,[Vr]).reduce(function(n,t){return n.concat([t,t+"-"+nn,t+"-"+Dn])},[]),sp="beforeRead",ap="read",lp="afterRead",cp="beforeMain",up="main",hp="afterMain",dp="beforeWrite",fp="write",pp="afterWrite",Mc=[sp,ap,lp,cp,up,hp,dp,fp,pp];function Xt(n){return n?(n.nodeName||"").toLowerCase():null}function Vt(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var t=n.ownerDocument;return t&&t.defaultView||window}return n}function Xe(n){var t=Vt(n).Element;return n instanceof t||n instanceof Element}function Yt(n){var t=Vt(n).HTMLElement;return n instanceof t||n instanceof HTMLElement}function zr(n){if(typeof ShadowRoot>"u")return!1;var t=Vt(n).ShadowRoot;return n instanceof t||n instanceof ShadowRoot}function mp(n){var t=n.state;Object.keys(t.elements).forEach(function(e){var i=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];!Yt(o)||!Xt(o)||(Object.assign(o.style,i),Object.keys(r).forEach(function(l){var a=r[l];a===!1?o.removeAttribute(l):o.setAttribute(l,a===!0?"":a)}))})}function gp(n){var t=n.state,e={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,e.popper),t.styles=e,t.elements.arrow&&Object.assign(t.elements.arrow.style,e.arrow),function(){Object.keys(t.elements).forEach(function(i){var r=t.elements[i],o=t.attributes[i]||{},l=Object.keys(t.styles.hasOwnProperty(i)?t.styles[i]:e[i]),a=l.reduce(function(h,f){return h[f]="",h},{});!Yt(r)||!Xt(r)||(Object.assign(r.style,a),Object.keys(o).forEach(function(h){r.removeAttribute(h)}))})}}var Bi={name:"applyStyles",enabled:!0,phase:"write",fn:mp,effect:gp,requires:["computeStyles"]};function $t(n){return n.split("-")[0]}var Ie=Math.max,Ln=Math.min,rn=Math.round;function xe(n,t){t===void 0&&(t=!1);var e=n.getBoundingClientRect(),i=1,r=1;if(Yt(n)&&t){var o=n.offsetHeight,l=n.offsetWidth;l>0&&(i=rn(e.width)/l||1),o>0&&(r=rn(e.height)/o||1)}return{width:e.width/i,height:e.height/r,top:e.top/r,right:e.right/i,bottom:e.bottom/r,left:e.left/i,x:e.left/i,y:e.top/r}}function Pn(n){var t=xe(n),e=n.offsetWidth,i=n.offsetHeight;return Math.abs(t.width-e)<=1&&(e=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:n.offsetLeft,y:n.offsetTop,width:e,height:i}}function Hi(n,t){var e=t.getRootNode&&t.getRootNode();if(n.contains(t))return!0;if(e&&zr(e)){var i=t;do{if(i&&n.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function me(n){return Vt(n).getComputedStyle(n)}function Ps(n){return["table","td","th"].indexOf(Xt(n))>=0}function ee(n){return((Xe(n)?n.ownerDocument:n.document)||window.document).documentElement}function on(n){return Xt(n)==="html"?n:n.assignedSlot||n.parentNode||(zr(n)?n.host:null)||ee(n)}function Ic(n){return!Yt(n)||me(n).position==="fixed"?null:n.offsetParent}function vp(n){var t=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,e=navigator.userAgent.indexOf("Trident")!==-1;if(e&&Yt(n)){var i=me(n);if(i.position==="fixed")return null}for(var r=on(n);Yt(r)&&["html","body"].indexOf(Xt(r))<0;){var o=me(r);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return r;r=r.parentNode}return null}function Re(n){for(var t=Vt(n),e=Ic(n);e&&Ps(e)&&me(e).position==="static";)e=Ic(e);return e&&(Xt(e)==="html"||Xt(e)==="body"&&me(e).position==="static")?t:e||vp(n)||t}function On(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function Mn(n,t,e){return Ie(n,Ln(t,e))}function Rc(n,t,e){var i=Mn(n,t,e);return i>e?e:i}function Wi(){return{top:0,right:0,bottom:0,left:0}}function ji(n){return Object.assign({},Wi(),n)}function Vi(n,t){return t.reduce(function(e,i){return e[i]=n,e},{})}var yp=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,ji(typeof t!="number"?t:Vi(t,mn))};function bp(n){var t,e=n.state,i=n.name,r=n.options,o=e.elements.arrow,l=e.modifiersData.popperOffsets,a=$t(e.placement),h=On(a),f=[jt,Ut].indexOf(a)>=0,s=f?"height":"width";if(!(!o||!l)){var c=yp(r.padding,e),d=Pn(o),u=h==="y"?Bt:jt,p=h==="y"?qt:Ut,m=e.rects.reference[s]+e.rects.reference[h]-l[h]-e.rects.popper[s],y=l[h]-e.rects.reference[h],g=Re(o),v=g?h==="y"?g.clientHeight||0:g.clientWidth||0:0,b=m/2-y/2,w=c[u],_=v-d[s]-c[p],C=v/2-d[s]/2+b,S=Mn(w,C,_),T=h;e.modifiersData[i]=(t={},t[T]=S,t.centerOffset=S-C,t)}}function wp(n){var t=n.state,e=n.options,i=e.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=t.elements.popper.querySelector(r),!r)||!Hi(t.elements.popper,r)||(t.elements.arrow=r))}var Nc={name:"arrow",enabled:!0,phase:"main",fn:bp,effect:wp,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ke(n){return n.split("-")[1]}var _p={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Cp(n){var t=n.x,e=n.y,i=window,r=i.devicePixelRatio||1;return{x:rn(t*r)/r||0,y:rn(e*r)/r||0}}function Fc(n){var t,e=n.popper,i=n.popperRect,r=n.placement,o=n.variation,l=n.offsets,a=n.position,h=n.gpuAcceleration,f=n.adaptive,s=n.roundOffsets,c=n.isFixed,d=l.x,u=d===void 0?0:d,p=l.y,m=p===void 0?0:p,y=typeof s=="function"?s({x:u,y:m}):{x:u,y:m};u=y.x,m=y.y;var g=l.hasOwnProperty("x"),v=l.hasOwnProperty("y"),b=jt,w=Bt,_=window;if(f){var C=Re(e),S="clientHeight",T="clientWidth";if(C===Vt(e)&&(C=ee(e),me(C).position!=="static"&&a==="absolute"&&(S="scrollHeight",T="scrollWidth")),C=C,r===Bt||(r===jt||r===Ut)&&o===Dn){w=qt;var I=c&&_.visualViewport?_.visualViewport.height:C[S];m-=I-i.height,m*=h?1:-1}if(r===jt||(r===Bt||r===qt)&&o===Dn){b=Ut;var F=c&&_.visualViewport?_.visualViewport.width:C[T];u-=F-i.width,u*=h?1:-1}}var P=Object.assign({position:a},f&&_p),L=s===!0?Cp({x:u,y:m}):{x:u,y:m};if(u=L.x,m=L.y,h){var k;return Object.assign({},P,(k={},k[w]=v?"0":"",k[b]=g?"0":"",k.transform=(_.devicePixelRatio||1)<=1?"translate("+u+"px, "+m+"px)":"translate3d("+u+"px, "+m+"px, 0)",k))}return Object.assign({},P,(t={},t[w]=v?m+"px":"",t[b]=g?u+"px":"",t.transform="",t))}function Sp(n){var t=n.state,e=n.options,i=e.gpuAcceleration,r=i===void 0?!0:i,o=e.adaptive,l=o===void 0?!0:o,a=e.roundOffsets,h=a===void 0?!0:a;if(!1)var f;var s={placement:$t(t.placement),variation:ke(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Fc(Object.assign({},s,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:l,roundOffsets:h})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Fc(Object.assign({},s,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:h})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var Bc={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Sp,data:{}};var qr={passive:!0};function Ap(n){var t=n.state,e=n.instance,i=n.options,r=i.scroll,o=r===void 0?!0:r,l=i.resize,a=l===void 0?!0:l,h=Vt(t.elements.popper),f=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&f.forEach(function(s){s.addEventListener("scroll",e.update,qr)}),a&&h.addEventListener("resize",e.update,qr),function(){o&&f.forEach(function(s){s.removeEventListener("scroll",e.update,qr)}),a&&h.removeEventListener("resize",e.update,qr)}}var Hc={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Ap,data:{}};var Ep={left:"right",right:"left",bottom:"top",top:"bottom"};function oi(n){return n.replace(/left|right|bottom|top/g,function(t){return Ep[t]})}var Tp={start:"end",end:"start"};function Yr(n){return n.replace(/start|end/g,function(t){return Tp[t]})}function In(n){var t=Vt(n),e=t.pageXOffset,i=t.pageYOffset;return{scrollLeft:e,scrollTop:i}}function Rn(n){return xe(ee(n)).left+In(n).scrollLeft}function Os(n){var t=Vt(n),e=ee(n),i=t.visualViewport,r=e.clientWidth,o=e.clientHeight,l=0,a=0;return i&&(r=i.width,o=i.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(l=i.offsetLeft,a=i.offsetTop)),{width:r,height:o,x:l+Rn(n),y:a}}function Ms(n){var t,e=ee(n),i=In(n),r=(t=n.ownerDocument)==null?void 0:t.body,o=Ie(e.scrollWidth,e.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),l=Ie(e.scrollHeight,e.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+Rn(n),h=-i.scrollTop;return me(r||e).direction==="rtl"&&(a+=Ie(e.clientWidth,r?r.clientWidth:0)-o),{width:o,height:l,x:a,y:h}}function Nn(n){var t=me(n),e=t.overflow,i=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(e+r+i)}function Kr(n){return["html","body","#document"].indexOf(Xt(n))>=0?n.ownerDocument.body:Yt(n)&&Nn(n)?n:Kr(on(n))}function gn(n,t){var e;t===void 0&&(t=[]);var i=Kr(n),r=i===((e=n.ownerDocument)==null?void 0:e.body),o=Vt(i),l=r?[o].concat(o.visualViewport||[],Nn(i)?i:[]):i,a=t.concat(l);return r?a:a.concat(gn(on(l)))}function si(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function xp(n){var t=xe(n);return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function Wc(n,t){return t===Ur?si(Os(n)):Xe(t)?xp(t):si(Ms(ee(n)))}function kp(n){var t=gn(on(n)),e=["absolute","fixed"].indexOf(me(n).position)>=0,i=e&&Yt(n)?Re(n):n;return Xe(i)?t.filter(function(r){return Xe(r)&&Hi(r,i)&&Xt(r)!=="body"}):[]}function Is(n,t,e){var i=t==="clippingParents"?kp(n):[].concat(t),r=[].concat(i,[e]),o=r[0],l=r.reduce(function(a,h){var f=Wc(n,h);return a.top=Ie(f.top,a.top),a.right=Ln(f.right,a.right),a.bottom=Ln(f.bottom,a.bottom),a.left=Ie(f.left,a.left),a},Wc(n,o));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function Ui(n){var t=n.reference,e=n.element,i=n.placement,r=i?$t(i):null,o=i?ke(i):null,l=t.x+t.width/2-e.width/2,a=t.y+t.height/2-e.height/2,h;switch(r){case Bt:h={x:l,y:t.y-e.height};break;case qt:h={x:l,y:t.y+t.height};break;case Ut:h={x:t.x+t.width,y:a};break;case jt:h={x:t.x-e.width,y:a};break;default:h={x:t.x,y:t.y}}var f=r?On(r):null;if(f!=null){var s=f==="y"?"height":"width";switch(o){case nn:h[f]=h[f]-(t[s]/2-e[s]/2);break;case Dn:h[f]=h[f]+(t[s]/2-e[s]/2);break;default:}}return h}function Ne(n,t){t===void 0&&(t={});var e=t,i=e.placement,r=i===void 0?n.placement:i,o=e.boundary,l=o===void 0?Pc:o,a=e.rootBoundary,h=a===void 0?Ur:a,f=e.elementContext,s=f===void 0?ri:f,c=e.altBoundary,d=c===void 0?!1:c,u=e.padding,p=u===void 0?0:u,m=ji(typeof p!="number"?p:Vi(p,mn)),y=s===ri?Oc:ri,g=n.rects.popper,v=n.elements[d?y:s],b=Is(Xe(v)?v:v.contextElement||ee(n.elements.popper),l,h),w=xe(n.elements.reference),_=Ui({reference:w,element:g,strategy:"absolute",placement:r}),C=si(Object.assign({},g,_)),S=s===ri?C:w,T={top:b.top-S.top+m.top,bottom:S.bottom-b.bottom+m.bottom,left:b.left-S.left+m.left,right:S.right-b.right+m.right},I=n.modifiersData.offset;if(s===ri&&I){var F=I[r];Object.keys(T).forEach(function(P){var L=[Ut,qt].indexOf(P)>=0?1:-1,k=[Bt,qt].indexOf(P)>=0?"y":"x";T[P]+=F[k]*L})}return T}function Rs(n,t){t===void 0&&(t={});var e=t,i=e.placement,r=e.boundary,o=e.rootBoundary,l=e.padding,a=e.flipVariations,h=e.allowedAutoPlacements,f=h===void 0?Gr:h,s=ke(i),c=s?a?Ls:Ls.filter(function(p){return ke(p)===s}):mn,d=c.filter(function(p){return f.indexOf(p)>=0});d.length===0&&(d=c);var u=d.reduce(function(p,m){return p[m]=Ne(n,{placement:m,boundary:r,rootBoundary:o,padding:l})[$t(m)],p},{});return Object.keys(u).sort(function(p,m){return u[p]-u[m]})}function Dp(n){if($t(n)===Vr)return[];var t=oi(n);return[Yr(n),t,Yr(t)]}function Lp(n){var t=n.state,e=n.options,i=n.name;if(!t.modifiersData[i]._skip){for(var r=e.mainAxis,o=r===void 0?!0:r,l=e.altAxis,a=l===void 0?!0:l,h=e.fallbackPlacements,f=e.padding,s=e.boundary,c=e.rootBoundary,d=e.altBoundary,u=e.flipVariations,p=u===void 0?!0:u,m=e.allowedAutoPlacements,y=t.options.placement,g=$t(y),v=g===y,b=h||(v||!p?[oi(y)]:Dp(y)),w=[y].concat(b).reduce(function(et,ft){return et.concat($t(ft)===Vr?Rs(t,{placement:ft,boundary:s,rootBoundary:c,padding:f,flipVariations:p,allowedAutoPlacements:m}):ft)},[]),_=t.rects.reference,C=t.rects.popper,S=new Map,T=!0,I=w[0],F=0;F<w.length;F++){var P=w[F],L=$t(P),k=ke(P)===nn,A=[Bt,qt].indexOf(L)>=0,E=A?"width":"height",O=Ne(t,{placement:P,boundary:s,rootBoundary:c,altBoundary:d,padding:f}),j=A?k?Ut:jt:k?qt:Bt;_[E]>C[E]&&(j=oi(j));var Y=oi(j),$=[];if(o&&$.push(O[L]<=0),a&&$.push(O[j]<=0,O[Y]<=0),$.every(function(et){return et})){I=P,T=!1;break}S.set(P,$)}if(T)for(var Z=p?3:1,K=function(ft){var bt=w.find(function(Ot){var Mt=S.get(Ot);if(Mt)return Mt.slice(0,ft).every(function(Ht){return Ht})});if(bt)return I=bt,"break"},tt=Z;tt>0;tt--){var nt=K(tt);if(nt==="break")break}t.placement!==I&&(t.modifiersData[i]._skip=!0,t.placement=I,t.reset=!0)}}var jc={name:"flip",enabled:!0,phase:"main",fn:Lp,requiresIfExists:["offset"],data:{_skip:!1}};function Vc(n,t,e){return e===void 0&&(e={x:0,y:0}),{top:n.top-t.height-e.y,right:n.right-t.width+e.x,bottom:n.bottom-t.height+e.y,left:n.left-t.width-e.x}}function Uc(n){return[Bt,Ut,qt,jt].some(function(t){return n[t]>=0})}function Pp(n){var t=n.state,e=n.name,i=t.rects.reference,r=t.rects.popper,o=t.modifiersData.preventOverflow,l=Ne(t,{elementContext:"reference"}),a=Ne(t,{altBoundary:!0}),h=Vc(l,i),f=Vc(a,r,o),s=Uc(h),c=Uc(f);t.modifiersData[e]={referenceClippingOffsets:h,popperEscapeOffsets:f,isReferenceHidden:s,hasPopperEscaped:c},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":s,"data-popper-escaped":c})}var Gc={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Pp};function Op(n,t,e){var i=$t(n),r=[jt,Bt].indexOf(i)>=0?-1:1,o=typeof e=="function"?e(Object.assign({},t,{placement:n})):e,l=o[0],a=o[1];return l=l||0,a=(a||0)*r,[jt,Ut].indexOf(i)>=0?{x:a,y:l}:{x:l,y:a}}function Mp(n){var t=n.state,e=n.options,i=n.name,r=e.offset,o=r===void 0?[0,0]:r,l=Gr.reduce(function(s,c){return s[c]=Op(c,t.rects,o),s},{}),a=l[t.placement],h=a.x,f=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=h,t.modifiersData.popperOffsets.y+=f),t.modifiersData[i]=l}var zc={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Mp};function Ip(n){var t=n.state,e=n.name;t.modifiersData[e]=Ui({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}var qc={name:"popperOffsets",enabled:!0,phase:"read",fn:Ip,data:{}};function Ns(n){return n==="x"?"y":"x"}function Rp(n){var t=n.state,e=n.options,i=n.name,r=e.mainAxis,o=r===void 0?!0:r,l=e.altAxis,a=l===void 0?!1:l,h=e.boundary,f=e.rootBoundary,s=e.altBoundary,c=e.padding,d=e.tether,u=d===void 0?!0:d,p=e.tetherOffset,m=p===void 0?0:p,y=Ne(t,{boundary:h,rootBoundary:f,padding:c,altBoundary:s}),g=$t(t.placement),v=ke(t.placement),b=!v,w=On(g),_=Ns(w),C=t.modifiersData.popperOffsets,S=t.rects.reference,T=t.rects.popper,I=typeof m=="function"?m(Object.assign({},t.rects,{placement:t.placement})):m,F=typeof I=="number"?{mainAxis:I,altAxis:I}:Object.assign({mainAxis:0,altAxis:0},I),P=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(!!C){if(o){var k,A=w==="y"?Bt:jt,E=w==="y"?qt:Ut,O=w==="y"?"height":"width",j=C[w],Y=j+y[A],$=j-y[E],Z=u?-T[O]/2:0,K=v===nn?S[O]:T[O],tt=v===nn?-T[O]:-S[O],nt=t.elements.arrow,et=u&&nt?Pn(nt):{width:0,height:0},ft=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Wi(),bt=ft[A],Ot=ft[E],Mt=Mn(0,S[O],et[O]),Ht=b?S[O]/2-Z-Mt-bt-F.mainAxis:K-Mt-bt-F.mainAxis,pt=b?-S[O]/2+Z+Mt+Ot+F.mainAxis:tt+Mt+Ot+F.mainAxis,z=t.elements.arrow&&Re(t.elements.arrow),V=z?w==="y"?z.clientTop||0:z.clientLeft||0:0,R=(k=P==null?void 0:P[w])!=null?k:0,M=j+Ht-R-V,B=j+pt-R,N=Mn(u?Ln(Y,M):Y,j,u?Ie($,B):$);C[w]=N,L[w]=N-j}if(a){var Et,Ft=w==="x"?Bt:jt,Kt=w==="x"?qt:Ut,te=C[_],kt=_==="y"?"height":"width",de=te+y[Ft],Ve=te-y[Kt],Ue=[Bt,jt].indexOf(g)!==-1,$n=(Et=P==null?void 0:P[_])!=null?Et:0,En=Ue?de:te-S[kt]-T[kt]-$n+F.altAxis,Zn=Ue?te+S[kt]+T[kt]-$n-F.altAxis:Ve,Tn=u&&Ue?Rc(En,te,Zn):Mn(u?En:de,te,u?Zn:Ve);C[_]=Tn,L[_]=Tn-te}t.modifiersData[i]=L}}var Yc={name:"preventOverflow",enabled:!0,phase:"main",fn:Rp,requiresIfExists:["offset"]};function Fs(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function Bs(n){return n===Vt(n)||!Yt(n)?In(n):Fs(n)}function Np(n){var t=n.getBoundingClientRect(),e=rn(t.width)/n.offsetWidth||1,i=rn(t.height)/n.offsetHeight||1;return e!==1||i!==1}function Hs(n,t,e){e===void 0&&(e=!1);var i=Yt(t),r=Yt(t)&&Np(t),o=ee(t),l=xe(n,r),a={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(i||!i&&!e)&&((Xt(t)!=="body"||Nn(o))&&(a=Bs(t)),Yt(t)?(h=xe(t,!0),h.x+=t.clientLeft,h.y+=t.clientTop):o&&(h.x=Rn(o))),{x:l.left+a.scrollLeft-h.x,y:l.top+a.scrollTop-h.y,width:l.width,height:l.height}}function Fp(n){var t=new Map,e=new Set,i=[];n.forEach(function(o){t.set(o.name,o)});function r(o){e.add(o.name);var l=[].concat(o.requires||[],o.requiresIfExists||[]);l.forEach(function(a){if(!e.has(a)){var h=t.get(a);h&&r(h)}}),i.push(o)}return n.forEach(function(o){e.has(o.name)||r(o)}),i}function Ws(n){var t=Fp(n);return Mc.reduce(function(e,i){return e.concat(t.filter(function(r){return r.phase===i}))},[])}function js(n){var t;return function(){return t||(t=new Promise(function(e){Promise.resolve().then(function(){t=void 0,e(n())})})),t}}function Vs(n){var t=n.reduce(function(e,i){var r=e[i.name];return e[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,e},{});return Object.keys(t).map(function(e){return t[e]})}var Kc={placement:"bottom",modifiers:[],strategy:"absolute"};function Xc(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];return!t.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function $c(n){n===void 0&&(n={});var t=n,e=t.defaultModifiers,i=e===void 0?[]:e,r=t.defaultOptions,o=r===void 0?Kc:r;return function(a,h,f){f===void 0&&(f=o);var s={placement:"bottom",orderedModifiers:[],options:Object.assign({},Kc,o),modifiersData:{},elements:{reference:a,popper:h},attributes:{},styles:{}},c=[],d=!1,u={state:s,setOptions:function(g){var v=typeof g=="function"?g(s.options):g;m(),s.options=Object.assign({},o,s.options,v),s.scrollParents={reference:Xe(a)?gn(a):a.contextElement?gn(a.contextElement):[],popper:gn(h)};var b=Ws(Vs([].concat(i,s.options.modifiers)));if(s.orderedModifiers=b.filter(function(P){return P.enabled}),!1){var w;if(getBasePlacement(s.options.placement)===auto)var _;var C,S,T,I,F}return p(),u.update()},forceUpdate:function(){if(!d){var g=s.elements,v=g.reference,b=g.popper;if(!!Xc(v,b)){s.rects={reference:Hs(v,Re(b),s.options.strategy==="fixed"),popper:Pn(b)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach(function(P){return s.modifiersData[P.name]=Object.assign({},P.data)});for(var w=0,_=0;_<s.orderedModifiers.length;_++){if(s.reset===!0){s.reset=!1,_=-1;continue}var C=s.orderedModifiers[_],S=C.fn,T=C.options,I=T===void 0?{}:T,F=C.name;typeof S=="function"&&(s=S({state:s,options:I,name:F,instance:u})||s)}}}},update:js(function(){return new Promise(function(y){u.forceUpdate(),y(s)})}),destroy:function(){m(),d=!0}};if(!Xc(a,h))return u;u.setOptions(f).then(function(y){!d&&f.onFirstUpdate&&f.onFirstUpdate(y)});function p(){s.orderedModifiers.forEach(function(y){var g=y.name,v=y.options,b=v===void 0?{}:v,w=y.effect;if(typeof w=="function"){var _=w({state:s,name:g,instance:u,options:b}),C=function(){};c.push(_||C)}})}function m(){c.forEach(function(y){return y()}),c=[]}return u}}var Bp=[Hc,qc,Bc,Bi,zc,jc,Yc,Nc,Gc],Us=$c({defaultModifiers:Bp});var Hp="tippy-box",su="tippy-content",Wp="tippy-backdrop",au="tippy-arrow",lu="tippy-svg-arrow",Fn={passive:!0,capture:!0},cu=function(){return document.body};function Gs(n,t,e){if(Array.isArray(n)){var i=n[t];return i??(Array.isArray(e)?e[t]:e)}return n}function $s(n,t){var e={}.toString.call(n);return e.indexOf("[object")===0&&e.indexOf(t+"]")>-1}function uu(n,t){return typeof n=="function"?n.apply(void 0,t):n}function Zc(n,t){if(t===0)return n;var e;return function(i){clearTimeout(e),e=setTimeout(function(){n(i)},t)}}function jp(n){return n.split(/\s+/).filter(Boolean)}function ai(n){return[].concat(n)}function Jc(n,t){n.indexOf(t)===-1&&n.push(t)}function Vp(n){return n.filter(function(t,e){return n.indexOf(t)===e})}function Up(n){return n.split("-")[0]}function $r(n){return[].slice.call(n)}function Qc(n){return Object.keys(n).reduce(function(t,e){return n[e]!==void 0&&(t[e]=n[e]),t},{})}function Gi(){return document.createElement("div")}function Zr(n){return["Element","Fragment"].some(function(t){return $s(n,t)})}function Gp(n){return $s(n,"NodeList")}function zp(n){return $s(n,"MouseEvent")}function qp(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function Yp(n){return Zr(n)?[n]:Gp(n)?$r(n):Array.isArray(n)?n:$r(document.querySelectorAll(n))}function zs(n,t){n.forEach(function(e){e&&(e.style.transitionDuration=t+"ms")})}function tu(n,t){n.forEach(function(e){e&&e.setAttribute("data-state",t)})}function Kp(n){var t,e=ai(n),i=e[0];return i!=null&&(t=i.ownerDocument)!=null&&t.body?i.ownerDocument:document}function Xp(n,t){var e=t.clientX,i=t.clientY;return n.every(function(r){var o=r.popperRect,l=r.popperState,a=r.props,h=a.interactiveBorder,f=Up(l.placement),s=l.modifiersData.offset;if(!s)return!0;var c=f==="bottom"?s.top.y:0,d=f==="top"?s.bottom.y:0,u=f==="right"?s.left.x:0,p=f==="left"?s.right.x:0,m=o.top-i+c>h,y=i-o.bottom-d>h,g=o.left-e+u>h,v=e-o.right-p>h;return m||y||g||v})}function qs(n,t,e){var i=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){n[i](r,e)})}function eu(n,t){for(var e=t;e;){var i;if(n.contains(e))return!0;e=e.getRootNode==null||(i=e.getRootNode())==null?void 0:i.host}return!1}var $e={isTouch:!1},nu=0;function $p(){$e.isTouch||($e.isTouch=!0,window.performance&&document.addEventListener("mousemove",hu))}function hu(){var n=performance.now();n-nu<20&&($e.isTouch=!1,document.removeEventListener("mousemove",hu)),nu=n}function Zp(){var n=document.activeElement;if(qp(n)){var t=n._tippy;n.blur&&!t.state.isVisible&&n.blur()}}function Jp(){document.addEventListener("touchstart",$p,Fn),window.addEventListener("blur",Zp)}var Qp=typeof window<"u"&&typeof document<"u",tm=Qp?!!window.msCrypto:!1;var em={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},nm={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Fe=Object.assign({appendTo:cu,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},em,nm),im=Object.keys(Fe),rm=function(t){var e=Object.keys(t);e.forEach(function(i){Fe[i]=t[i]})};function du(n){var t=n.plugins||[],e=t.reduce(function(i,r){var o=r.name,l=r.defaultValue;if(o){var a;i[o]=n[o]!==void 0?n[o]:(a=Fe[o])!=null?a:l}return i},{});return Object.assign({},n,e)}function om(n,t){var e=t?Object.keys(du(Object.assign({},Fe,{plugins:t}))):im,i=e.reduce(function(r,o){var l=(n.getAttribute("data-tippy-"+o)||"").trim();if(!l)return r;if(o==="content")r[o]=l;else try{r[o]=JSON.parse(l)}catch{r[o]=l}return r},{});return i}function iu(n,t){var e=Object.assign({},t,{content:uu(t.content,[n])},t.ignoreAttributes?{}:om(n,t.plugins));return e.aria=Object.assign({},Fe.aria,e.aria),e.aria={expanded:e.aria.expanded==="auto"?t.interactive:e.aria.expanded,content:e.aria.content==="auto"?t.interactive?null:"describedby":e.aria.content},e}var sm=function(){return"innerHTML"};function Ks(n,t){n[sm()]=t}function ru(n){var t=Gi();return n===!0?t.className=au:(t.className=lu,Zr(n)?t.appendChild(n):Ks(t,n)),t}function ou(n,t){Zr(t.content)?(Ks(n,""),n.appendChild(t.content)):typeof t.content!="function"&&(t.allowHTML?Ks(n,t.content):n.textContent=t.content)}function Xs(n){var t=n.firstElementChild,e=$r(t.children);return{box:t,content:e.find(function(i){return i.classList.contains(su)}),arrow:e.find(function(i){return i.classList.contains(au)||i.classList.contains(lu)}),backdrop:e.find(function(i){return i.classList.contains(Wp)})}}function fu(n){var t=Gi(),e=Gi();e.className=Hp,e.setAttribute("data-state","hidden"),e.setAttribute("tabindex","-1");var i=Gi();i.className=su,i.setAttribute("data-state","hidden"),ou(i,n.props),t.appendChild(e),e.appendChild(i),r(n.props,n.props);function r(o,l){var a=Xs(t),h=a.box,f=a.content,s=a.arrow;l.theme?h.setAttribute("data-theme",l.theme):h.removeAttribute("data-theme"),typeof l.animation=="string"?h.setAttribute("data-animation",l.animation):h.removeAttribute("data-animation"),l.inertia?h.setAttribute("data-inertia",""):h.removeAttribute("data-inertia"),h.style.maxWidth=typeof l.maxWidth=="number"?l.maxWidth+"px":l.maxWidth,l.role?h.setAttribute("role",l.role):h.removeAttribute("role"),(o.content!==l.content||o.allowHTML!==l.allowHTML)&&ou(f,n.props),l.arrow?s?o.arrow!==l.arrow&&(h.removeChild(s),h.appendChild(ru(l.arrow))):h.appendChild(ru(l.arrow)):s&&h.removeChild(s)}return{popper:t,onUpdate:r}}fu.$$tippy=!0;var am=1,Xr=[],Ys=[];function lm(n,t){var e=iu(n,Object.assign({},Fe,du(Qc(t)))),i,r,o,l=!1,a=!1,h=!1,f=!1,s,c,d,u=[],p=Zc(M,e.interactiveDebounce),m,y=am++,g=null,v=Vp(e.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},w={id:y,reference:n,popper:Gi(),popperInstance:g,props:e,state:b,plugins:v,clearDelayTimeouts:En,setProps:Zn,setContent:Tn,show:qo,hide:Yo,hideWithInteractivity:Ko,enable:Ue,disable:$n,unmount:Xo,destroy:Dt};if(!e.render)return w;var _=e.render(w),C=_.popper,S=_.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+w.id,w.popper=C,n._tippy=w,C._tippy=w;var T=v.map(function(G){return G.fn(w)}),I=n.hasAttribute("aria-expanded");return z(),Z(),j(),Y("onCreate",[w]),e.showOnCreate&&de(),C.addEventListener("mouseenter",function(){w.props.interactive&&w.state.isVisible&&w.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){w.props.interactive&&w.props.trigger.indexOf("mouseenter")>=0&&A().addEventListener("mousemove",p)}),w;function F(){var G=w.props.touch;return Array.isArray(G)?G:[G,0]}function P(){return F()[0]==="hold"}function L(){var G;return!!((G=w.props.render)!=null&&G.$$tippy)}function k(){return m||n}function A(){var G=k().parentNode;return G?Kp(G):document}function E(){return Xs(C)}function O(G){return w.state.isMounted&&!w.state.isVisible||$e.isTouch||s&&s.type==="focus"?0:Gs(w.props.delay,G?0:1,Fe.delay)}function j(G){G===void 0&&(G=!1),C.style.pointerEvents=w.props.interactive&&!G?"":"none",C.style.zIndex=""+w.props.zIndex}function Y(G,it,ct){if(ct===void 0&&(ct=!0),T.forEach(function(gt){gt[G]&&gt[G].apply(gt,it)}),ct){var wt;(wt=w.props)[G].apply(wt,it)}}function $(){var G=w.props.aria;if(!!G.content){var it="aria-"+G.content,ct=C.id,wt=ai(w.props.triggerTarget||n);wt.forEach(function(gt){var Pt=gt.getAttribute(it);if(w.state.isVisible)gt.setAttribute(it,Pt?Pt+" "+ct:ct);else{var ve=Pt&&Pt.replace(ct,"").trim();ve?gt.setAttribute(it,ve):gt.removeAttribute(it)}})}}function Z(){if(!(I||!w.props.aria.expanded)){var G=ai(w.props.triggerTarget||n);G.forEach(function(it){w.props.interactive?it.setAttribute("aria-expanded",w.state.isVisible&&it===k()?"true":"false"):it.removeAttribute("aria-expanded")})}}function K(){A().removeEventListener("mousemove",p),Xr=Xr.filter(function(G){return G!==p})}function tt(G){if(!($e.isTouch&&(h||G.type==="mousedown"))){var it=G.composedPath&&G.composedPath()[0]||G.target;if(!(w.props.interactive&&eu(C,it))){if(ai(w.props.triggerTarget||n).some(function(ct){return eu(ct,it)})){if($e.isTouch||w.state.isVisible&&w.props.trigger.indexOf("click")>=0)return}else Y("onClickOutside",[w,G]);w.props.hideOnClick===!0&&(w.clearDelayTimeouts(),w.hide(),a=!0,setTimeout(function(){a=!1}),w.state.isMounted||bt())}}}function nt(){h=!0}function et(){h=!1}function ft(){var G=A();G.addEventListener("mousedown",tt,!0),G.addEventListener("touchend",tt,Fn),G.addEventListener("touchstart",et,Fn),G.addEventListener("touchmove",nt,Fn)}function bt(){var G=A();G.removeEventListener("mousedown",tt,!0),G.removeEventListener("touchend",tt,Fn),G.removeEventListener("touchstart",et,Fn),G.removeEventListener("touchmove",nt,Fn)}function Ot(G,it){Ht(G,function(){!w.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&it()})}function Mt(G,it){Ht(G,it)}function Ht(G,it){var ct=E().box;function wt(gt){gt.target===ct&&(qs(ct,"remove",wt),it())}if(G===0)return it();qs(ct,"remove",c),qs(ct,"add",wt),c=wt}function pt(G,it,ct){ct===void 0&&(ct=!1);var wt=ai(w.props.triggerTarget||n);wt.forEach(function(gt){gt.addEventListener(G,it,ct),u.push({node:gt,eventType:G,handler:it,options:ct})})}function z(){P()&&(pt("touchstart",R,{passive:!0}),pt("touchend",B,{passive:!0})),jp(w.props.trigger).forEach(function(G){if(G!=="manual")switch(pt(G,R),G){case"mouseenter":pt("mouseleave",B);break;case"focus":pt(tm?"focusout":"blur",N);break;case"focusin":pt("focusout",N);break}})}function V(){u.forEach(function(G){var it=G.node,ct=G.eventType,wt=G.handler,gt=G.options;it.removeEventListener(ct,wt,gt)}),u=[]}function R(G){var it,ct=!1;if(!(!w.state.isEnabled||Et(G)||a)){var wt=((it=s)==null?void 0:it.type)==="focus";s=G,m=G.currentTarget,Z(),!w.state.isVisible&&zp(G)&&Xr.forEach(function(gt){return gt(G)}),G.type==="click"&&(w.props.trigger.indexOf("mouseenter")<0||l)&&w.props.hideOnClick!==!1&&w.state.isVisible?ct=!0:de(G),G.type==="click"&&(l=!ct),ct&&!wt&&Ve(G)}}function M(G){var it=G.target,ct=k().contains(it)||C.contains(it);if(!(G.type==="mousemove"&&ct)){var wt=kt().concat(C).map(function(gt){var Pt,ve=gt._tippy,cn=(Pt=ve.popperInstance)==null?void 0:Pt.state;return cn?{popperRect:gt.getBoundingClientRect(),popperState:cn,props:e}:null}).filter(Boolean);Xp(wt,G)&&(K(),Ve(G))}}function B(G){var it=Et(G)||w.props.trigger.indexOf("click")>=0&&l;if(!it){if(w.props.interactive){w.hideWithInteractivity(G);return}Ve(G)}}function N(G){w.props.trigger.indexOf("focusin")<0&&G.target!==k()||w.props.interactive&&G.relatedTarget&&C.contains(G.relatedTarget)||Ve(G)}function Et(G){return $e.isTouch?P()!==G.type.indexOf("touch")>=0:!1}function Ft(){Kt();var G=w.props,it=G.popperOptions,ct=G.placement,wt=G.offset,gt=G.getReferenceClientRect,Pt=G.moveTransition,ve=L()?Xs(C).arrow:null,cn=gt?{getBoundingClientRect:gt,contextElement:gt.contextElement||k()}:n,x={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(U){var Q=U.state;if(L()){var X=E(),at=X.box;["placement","reference-hidden","escaped"].forEach(function(rt){rt==="placement"?at.setAttribute("data-placement",Q.placement):Q.attributes.popper["data-popper-"+rt]?at.setAttribute("data-"+rt,""):at.removeAttribute("data-"+rt)}),Q.attributes.popper={}}}},D=[{name:"offset",options:{offset:wt}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Pt}},x];L()&&ve&&D.push({name:"arrow",options:{element:ve,padding:3}}),D.push.apply(D,(it==null?void 0:it.modifiers)||[]),w.popperInstance=Us(cn,C,Object.assign({},it,{placement:ct,onFirstUpdate:d,modifiers:D}))}function Kt(){w.popperInstance&&(w.popperInstance.destroy(),w.popperInstance=null)}function te(){var G=w.props.appendTo,it,ct=k();w.props.interactive&&G===cu||G==="parent"?it=ct.parentNode:it=uu(G,[ct]),it.contains(C)||it.appendChild(C),w.state.isMounted=!0,Ft()}function kt(){return $r(C.querySelectorAll("[data-tippy-root]"))}function de(G){w.clearDelayTimeouts(),G&&Y("onTrigger",[w,G]),ft();var it=O(!0),ct=F(),wt=ct[0],gt=ct[1];$e.isTouch&&wt==="hold"&&gt&&(it=gt),it?i=setTimeout(function(){w.show()},it):w.show()}function Ve(G){if(w.clearDelayTimeouts(),Y("onUntrigger",[w,G]),!w.state.isVisible){bt();return}if(!(w.props.trigger.indexOf("mouseenter")>=0&&w.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(G.type)>=0&&l)){var it=O(!1);it?r=setTimeout(function(){w.state.isVisible&&w.hide()},it):o=requestAnimationFrame(function(){w.hide()})}}function Ue(){w.state.isEnabled=!0}function $n(){w.hide(),w.state.isEnabled=!1}function En(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(o)}function Zn(G){if(!w.state.isDestroyed){Y("onBeforeUpdate",[w,G]),V();var it=w.props,ct=iu(n,Object.assign({},it,Qc(G),{ignoreAttributes:!0}));w.props=ct,z(),it.interactiveDebounce!==ct.interactiveDebounce&&(K(),p=Zc(M,ct.interactiveDebounce)),it.triggerTarget&&!ct.triggerTarget?ai(it.triggerTarget).forEach(function(wt){wt.removeAttribute("aria-expanded")}):ct.triggerTarget&&n.removeAttribute("aria-expanded"),Z(),j(),S&&S(it,ct),w.popperInstance&&(Ft(),kt().forEach(function(wt){requestAnimationFrame(wt._tippy.popperInstance.forceUpdate)})),Y("onAfterUpdate",[w,G])}}function Tn(G){w.setProps({content:G})}function qo(){var G=w.state.isVisible,it=w.state.isDestroyed,ct=!w.state.isEnabled,wt=$e.isTouch&&!w.props.touch,gt=Gs(w.props.duration,0,Fe.duration);if(!(G||it||ct||wt)&&!k().hasAttribute("disabled")&&(Y("onShow",[w],!1),w.props.onShow(w)!==!1)){if(w.state.isVisible=!0,L()&&(C.style.visibility="visible"),j(),ft(),w.state.isMounted||(C.style.transition="none"),L()){var Pt=E(),ve=Pt.box,cn=Pt.content;zs([ve,cn],0)}d=function(){var D;if(!(!w.state.isVisible||f)){if(f=!0,C.offsetHeight,C.style.transition=w.props.moveTransition,L()&&w.props.animation){var H=E(),U=H.box,Q=H.content;zs([U,Q],gt),tu([U,Q],"visible")}$(),Z(),Jc(Ys,w),(D=w.popperInstance)==null||D.forceUpdate(),Y("onMount",[w]),w.props.animation&&L()&&Mt(gt,function(){w.state.isShown=!0,Y("onShown",[w])})}},te()}}function Yo(){var G=!w.state.isVisible,it=w.state.isDestroyed,ct=!w.state.isEnabled,wt=Gs(w.props.duration,1,Fe.duration);if(!(G||it||ct)&&(Y("onHide",[w],!1),w.props.onHide(w)!==!1)){if(w.state.isVisible=!1,w.state.isShown=!1,f=!1,l=!1,L()&&(C.style.visibility="hidden"),K(),bt(),j(!0),L()){var gt=E(),Pt=gt.box,ve=gt.content;w.props.animation&&(zs([Pt,ve],wt),tu([Pt,ve],"hidden"))}$(),Z(),w.props.animation?L()&&Ot(wt,w.unmount):w.unmount()}}function Ko(G){A().addEventListener("mousemove",p),Jc(Xr,p),p(G)}function Xo(){w.state.isVisible&&w.hide(),!!w.state.isMounted&&(Kt(),kt().forEach(function(G){G._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),Ys=Ys.filter(function(G){return G!==w}),w.state.isMounted=!1,Y("onHidden",[w]))}function Dt(){w.state.isDestroyed||(w.clearDelayTimeouts(),w.unmount(),V(),delete n._tippy,w.state.isDestroyed=!0,Y("onDestroy",[w]))}}function zi(n,t){t===void 0&&(t={});var e=Fe.plugins.concat(t.plugins||[]);Jp();var i=Object.assign({},t,{plugins:e}),r=Yp(n);if(!1)var o,l;var a=r.reduce(function(h,f){var s=f&&lm(f,i);return s&&h.push(s),h},[]);return Zr(n)?a[0]:a}zi.defaultProps=Fe;zi.setDefaultProps=rm;zi.currentInput=$e;var Z_=Object.assign({},Bi,{effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow)}});zi.setDefaultProps({render:fu});var Jr=zi;var Zs=class extends ut{connect(){this.clipboard=new pu.default(this.element),this.clipboard.on("success",n=>this.tooltip(this.successMessage)),this.clipboard.on("error",n=>this.tooltip(this.errorMessage))}tooltip(n){Jr(this.element,{content:n,showOnCreate:!0,onHidden:t=>{t.destroy()}})}get successMessage(){return this.successMessageValue||"Copied!"}get errorMessage(){return this.errorMessageValue||"Failed!"}};Wt(Zs,"values",{successMessage:String,errorMessage:String});var ia={};re(ia,{default:()=>na});var gu=qe(mu()),vu=qe(ea()),na=class extends ut{connect(){this.editor=this.fieldTarget.editor,this.initializeTribute()}initializeTribute(){this.tribute=new gu.default({allowSpaces:!0,lookup:"name",values:this.fetchUsers,menuShowMinLength:1}),this.tribute.attach(this.fieldTarget),this.fieldTarget.addEventListener("tribute-replaced",this.replaced),this.tribute.range.pasteHtml=this._pasteHtml.bind(this)}disconnect(){this.tribute.detach(this.fieldTarget)}fetchUsers(n,t){fetch(`/users/mentions.json?query=${n}`).then(e=>e.json()).then(e=>t(e)).catch(e=>t([]))}replaced(n){let t=n.detail.item.original,e=new vu.default.Attachment({content:t.content,sgid:t.sgid});this.editor.insertAttachment(e),this.editor.insertString(" ")}_pasteHtml(n,t,e){let r=this.editor.getSelectedRange()[0],o=e-t;this.editor.setSelectedRange([r-o,r]),this.editor.deleteInDirection("backward")}};Wt(na,"targets",["field"]);var ra={};re(ra,{default:()=>Qr});var Qr=class extends ut{connect(){this.subscription=Ni.subscriptions.create({channel:"NotificationChannel"},{connected:this._connected.bind(this),disconnected:this._disconnected.bind(this),received:this._received.bind(this)}),this.hasUnread()&&this.showUnreadBadge()}disconnect(){this.subscription.unsubscribe()}_connected(){}_disconnected(){}_received(n){this.totalUnreadValue+=1,n.account_id&&n.account_id==this.accountIdValue&&(this.accountUnreadValue+=1),!(n.account_id&&n.account_id!=this.accountIdValue)&&(n.html&&(this.listTarget.insertAdjacentHTML("afterbegin",n.html),this.showUnreadBadge()),n.browser&&this.checkPermissionAndNotify(n.browser))}open(){this.hideUnreadBadge(),this.markAllAsRead()}hasUnread(){return!!this.accountUnreadValue}showUnreadBadge(){this.hasBadgeTarget!=!1&&this.badgeTarget.classList.remove("hidden")}hideUnreadBadge(){this.hasBadgeTarget!=!1&&this.badgeTarget.classList.add("hidden")}markAllAsRead(){let n=this.notificationTargets.map(t=>t.dataset.id);this.subscription.perform("mark_as_read",{ids:n}),this.accountUnreadValue=0,this.totalUnreadValue-=n.length}markAsInteracted(n){let t=n.currentTarget.dataset.id;t!=null&&this.subscription.perform("mark_as_interacted",{ids:[t]})}checkPermissionAndNotify(n){"Notification"in window&&(Notification.permission==="granted"?this.browserNotification(n):Notification.permission!=="denied"&&Notification.requestPermission().then(t=>{t==="granted"&&this.browserNotification(n)}))}browserNotification(n){new Notification(n.title,n.options)}totalUnreadValueChanged(){this.syncCountToNative()}accountUnreadValueChanged(){this.syncCountToNative()}syncCountToNative(){window.TurboNativeBridge.setNotificationCount(this.totalUnreadValue,this.accountUnreadValue)}};Wt(Qr,"targets",["badge","list","placeholder","notification"]),Wt(Qr,"values",{accountId:String,accountUnread:Number,totalUnread:Number});var sa={};re(sa,{default:()=>oa});var oa=class extends ut{connect(){let n={method:"inline",allowQuantity:!1,disableLogout:!0,frameTarget:"paddle-checkout",frameInitialHeight:416,frameStyle:"width:100%; background-color: transparent; border: none;",successCallback:this.checkoutComplete.bind(this)};this.data.get("action")=="create-subscription"?Paddle.Checkout.open({...n,product:this.data.get("product"),email:this.data.get("email"),passthrough:this.data.get("passthrough")}):this.data.get("action")=="update-payment-details"&&Paddle.Checkout.open({...n,override:this.data.get("update-url")})}checkoutComplete(n){this.addHiddenField("processor","paddle"),Rails.fire(this.formTarget,"submit")}addHiddenField(n,t){let e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name",n),e.setAttribute("value",t),this.formTarget.appendChild(e)}};Wt(oa,"targets",["form"]);var la={};re(la,{default:()=>aa});var aa=class extends ut{connect(){braintree.client.create({authorization:this.data.get("clientToken")},this.clientCreated.bind(this))}disconnect(){this.buttonTarget.querySelector(".paypal-button").remove()}clientCreated(n,t){if(n){console.error("Error creating client",n);return}braintree.paypalCheckout.create({client:t},this.paypalCreated.bind(this))}paypalCreated(n,t){if(n){console.error("Error creating PayPal Checkout:",n);return}paypal.Button.render({env:this.data.get("env"),style:{color:"gold",shape:"rect",size:"medium",label:"pay",tagline:!1},payment:()=>t.createPayment({flow:"vault"}),onAuthorize:(e,i)=>t.tokenizePayment(e,this.paymentMethod.bind(this)),onCancel:e=>{console.log("checkout.js payment cancelled",JSON.stringify(e,0,2))},onError:e=>{console.error("checkout.js error",e)}},this.buttonTarget).then(()=>{})}paymentMethod(n,t){if(n){console.error("Error with payment method:",n);return}this.addHiddenField("processor","braintree"),this.addHiddenField("payment_method_token",t.nonce),Rails.fire(this.formTarget,"submit")}addHiddenField(n,t){let e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name",n),e.setAttribute("value",t),this.formTarget.appendChild(e)}};Wt(aa,"targets",["button","form"]);var ka={};re(ka,{default:()=>xh});var cm=Math.PI/180;function um(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}var Wn=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},st={_global:Wn,version:"8.3.2",isBrowser:um(),isUnminified:/param/.test(function(n){}.toString()),dblClickWindow:400,getAngle(n){return st.angleDeg?n*cm:n},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return st.DD.isDragging},isDragReady(){return!!st.DD.node},document:Wn.document,_injectGlobal(n){Wn.Konva=n}},se=n=>{st[n.prototype.getClassName()]=n};st._injectGlobal(st);var De=class{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new De(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){var e=this.m;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}}translate(t,e){return this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e,this}scale(t,e){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e,this}rotate(t){var e=Math.cos(t),i=Math.sin(t),r=this.m[0]*e+this.m[2]*i,o=this.m[1]*e+this.m[3]*i,l=this.m[0]*-i+this.m[2]*e,a=this.m[1]*-i+this.m[3]*e;return this.m[0]=r,this.m[1]=o,this.m[2]=l,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,e){var i=this.m[0]+this.m[2]*e,r=this.m[1]+this.m[3]*e,o=this.m[2]+this.m[0]*t,l=this.m[3]+this.m[1]*t;return this.m[0]=i,this.m[1]=r,this.m[2]=o,this.m[3]=l,this}multiply(t){var e=this.m[0]*t.m[0]+this.m[2]*t.m[1],i=this.m[1]*t.m[0]+this.m[3]*t.m[1],r=this.m[0]*t.m[2]+this.m[2]*t.m[3],o=this.m[1]*t.m[2]+this.m[3]*t.m[3],l=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],a=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=i,this.m[2]=r,this.m[3]=o,this.m[4]=l,this.m[5]=a,this}invert(){var t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,i=-this.m[1]*t,r=-this.m[2]*t,o=this.m[0]*t,l=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=i,this.m[2]=r,this.m[3]=o,this.m[4]=l,this.m[5]=a,this}getMatrix(){return this.m}setAbsolutePosition(t,e){var i=this.m[0],r=this.m[1],o=this.m[2],l=this.m[3],a=this.m[4],h=this.m[5],f=(i*(e-h)-r*(t-a))/(i*l-r*o),s=(t-a-o*f)/i;return this.translate(s,f)}decompose(){var t=this.m[0],e=this.m[1],i=this.m[2],r=this.m[3],o=this.m[4],l=this.m[5],a=t*r-e*i;let h={x:o,y:l,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(t!=0||e!=0){var f=Math.sqrt(t*t+e*e);h.rotation=e>0?Math.acos(t/f):-Math.acos(t/f),h.scaleX=f,h.scaleY=a/f,h.skewX=(t*i+e*r)/a,h.skewY=0}else if(i!=0||r!=0){var s=Math.sqrt(i*i+r*r);h.rotation=Math.PI/2-(r>0?Math.acos(-i/s):-Math.acos(i/s)),h.scaleX=a/s,h.scaleY=s,h.skewX=0,h.skewY=(t*i+e*r)/a}return h.rotation=W._getRotation(h.rotation),h}},hm="[object Array]",dm="[object Number]",fm="[object String]",pm="[object Boolean]",mm=Math.PI/180,gm=180/Math.PI,ca="#",vm="",ym="0",bm="Konva warning: ",yu="Konva error: ",wm="rgb(",ua={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},_m=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,to=[],Cm=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(n){setTimeout(n,60)},W={_isElement(n){return!!(n&&n.nodeType==1)},_isFunction(n){return!!(n&&n.constructor&&n.call&&n.apply)},_isPlainObject(n){return!!n&&n.constructor===Object},_isArray(n){return Object.prototype.toString.call(n)===hm},_isNumber(n){return Object.prototype.toString.call(n)===dm&&!isNaN(n)&&isFinite(n)},_isString(n){return Object.prototype.toString.call(n)===fm},_isBoolean(n){return Object.prototype.toString.call(n)===pm},isObject(n){return n instanceof Object},isValidSelector(n){if(typeof n!="string")return!1;var t=n[0];return t==="#"||t==="."||t===t.toUpperCase()},_sign(n){return n===0||n>0?1:-1},requestAnimFrame(n){to.push(n),to.length===1&&Cm(function(){let t=to;to=[],t.forEach(function(e){e()})})},createCanvasElement(){var n=document.createElement("canvas");try{n.style=n.style||{}}catch{}return n},createImageElement(){return document.createElement("img")},_isInDocument(n){for(;n=n.parentNode;)if(n==document)return!0;return!1},_urlToImage(n,t){var e=W.createImageElement();e.onload=function(){t(e)},e.src=n},_rgbToHex(n,t,e){return((1<<24)+(n<<16)+(t<<8)+e).toString(16).slice(1)},_hexToRgb(n){n=n.replace(ca,vm);var t=parseInt(n,16);return{r:t>>16&255,g:t>>8&255,b:t&255}},getRandomColor(){for(var n=(Math.random()*16777215<<0).toString(16);n.length<6;)n=ym+n;return ca+n},getRGB(n){var t;return n in ua?(t=ua[n],{r:t[0],g:t[1],b:t[2]}):n[0]===ca?this._hexToRgb(n.substring(1)):n.substr(0,4)===wm?(t=_m.exec(n.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(n){return n=n||"black",W._namedColorToRBA(n)||W._hex3ColorToRGBA(n)||W._hex6ColorToRGBA(n)||W._rgbColorToRGBA(n)||W._rgbaColorToRGBA(n)||W._hslColorToRGBA(n)},_namedColorToRBA(n){var t=ua[n.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(n){if(n.indexOf("rgb(")===0){n=n.match(/rgb\(([^)]+)\)/)[1];var t=n.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(n){if(n.indexOf("rgba(")===0){n=n.match(/rgba\(([^)]+)\)/)[1];var t=n.split(/ *, */).map((e,i)=>e.slice(-1)==="%"?i===3?parseInt(e)/100:parseInt(e)/100*255:Number(e));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex6ColorToRGBA(n){if(n[0]==="#"&&n.length===7)return{r:parseInt(n.slice(1,3),16),g:parseInt(n.slice(3,5),16),b:parseInt(n.slice(5,7),16),a:1}},_hex3ColorToRGBA(n){if(n[0]==="#"&&n.length===4)return{r:parseInt(n[1]+n[1],16),g:parseInt(n[2]+n[2],16),b:parseInt(n[3]+n[3],16),a:1}},_hslColorToRGBA(n){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(n)){let[t,...e]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(n),i=Number(e[0])/360,r=Number(e[1])/100,o=Number(e[2])/100,l,a,h;if(r===0)return h=o*255,{r:Math.round(h),g:Math.round(h),b:Math.round(h),a:1};o<.5?l=o*(1+r):l=o+r-o*r;let f=2*o-l,s=[0,0,0];for(let c=0;c<3;c++)a=i+1/3*-(c-1),a<0&&a++,a>1&&a--,6*a<1?h=f+(l-f)*6*a:2*a<1?h=l:3*a<2?h=f+(l-f)*(2/3-a)*6:h=f,s[c]=h*255;return{r:Math.round(s[0]),g:Math.round(s[1]),b:Math.round(s[2]),a:1}}},haveIntersection(n,t){return!(t.x>n.x+n.width||t.x+t.width<n.x||t.y>n.y+n.height||t.y+t.height<n.y)},cloneObject(n){var t={};for(var e in n)this._isPlainObject(n[e])?t[e]=this.cloneObject(n[e]):this._isArray(n[e])?t[e]=this.cloneArray(n[e]):t[e]=n[e];return t},cloneArray(n){return n.slice(0)},degToRad(n){return n*mm},radToDeg(n){return n*gm},_degToRad(n){return W.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),W.degToRad(n)},_radToDeg(n){return W.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),W.radToDeg(n)},_getRotation(n){return st.angleDeg?W.radToDeg(n):n},_capitalize(n){return n.charAt(0).toUpperCase()+n.slice(1)},throw(n){throw new Error(yu+n)},error(n){console.error(yu+n)},warn(n){!st.showWarnings||console.warn(bm+n)},each(n,t){for(var e in n)t(e,n[e])},_inRange(n,t,e){return t<=n&&n<e},_getProjectionToSegment(n,t,e,i,r,o){var l,a,h,f=(n-e)*(n-e)+(t-i)*(t-i);if(f==0)l=n,a=t,h=(r-e)*(r-e)+(o-i)*(o-i);else{var s=((r-n)*(e-n)+(o-t)*(i-t))/f;s<0?(l=n,a=t,h=(n-r)*(n-r)+(t-o)*(t-o)):s>1?(l=e,a=i,h=(e-r)*(e-r)+(i-o)*(i-o)):(l=n+s*(e-n),a=t+s*(i-t),h=(l-r)*(l-r)+(a-o)*(a-o))}return[l,a,h]},_getProjectionToLine(n,t,e){var i=W.cloneObject(n),r=Number.MAX_VALUE;return t.forEach(function(o,l){if(!(!e&&l===t.length-1)){var a=t[(l+1)%t.length],h=W._getProjectionToSegment(o.x,o.y,a.x,a.y,n.x,n.y),f=h[0],s=h[1],c=h[2];c<r&&(i.x=f,i.y=s,r=c)}}),i},_prepareArrayForTween(n,t,e){var i,r=[],o=[];if(n.length>t.length){var l=t;t=n,n=l}for(i=0;i<n.length;i+=2)r.push({x:n[i],y:n[i+1]});for(i=0;i<t.length;i+=2)o.push({x:t[i],y:t[i+1]});var a=[];return o.forEach(function(h){var f=W._getProjectionToLine(h,r,e);a.push(f.x),a.push(f.y)}),a},_prepareToStringify(n){var t;n.visitedByCircularReferenceRemoval=!0;for(var e in n)if(!!(n.hasOwnProperty(e)&&n[e]&&typeof n[e]=="object")){if(t=Object.getOwnPropertyDescriptor(n,e),n[e].visitedByCircularReferenceRemoval||W._isElement(n[e]))if(t.configurable)delete n[e];else return null;else if(W._prepareToStringify(n[e])===null)if(t.configurable)delete n[e];else return null}return delete n.visitedByCircularReferenceRemoval,n},_assign(n,t){for(var e in t)n[e]=t[e];return n},_getFirstPointerId(n){return n.touches?n.changedTouches[0].identifier:n.pointerId||999}};function vn(n){return W._isString(n)?'"'+n+'"':Object.prototype.toString.call(n)==="[object Number]"||W._isBoolean(n)?n:Object.prototype.toString.call(n)}function ht(){if(st.isUnminified)return function(n,t){return W._isNumber(n)||W.warn(vn(n)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),n}}function bu(n){if(st.isUnminified)return function(t,e){let i=W._isNumber(t),r=W._isArray(t)&&t.length==n;return!i&&!r&&W.warn(vn(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or Array<number>('+n+")"),t}}function qi(){if(st.isUnminified)return function(n,t){var e=W._isNumber(n),i=n==="auto";return e||i||W.warn(vn(n)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),n}}function sn(){if(st.isUnminified)return function(n,t){return W._isString(n)||W.warn(vn(n)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),n}}function ha(){if(st.isUnminified)return function(n,t){let e=W._isString(n),i=Object.prototype.toString.call(n)==="[object CanvasGradient]"||n&&n.addColorStop;return e||i||W.warn(vn(n)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),n}}function wu(){if(st.isUnminified)return function(n,t){return W._isArray(n)?n.forEach(function(e){W._isNumber(e)||W.warn('"'+t+'" attribute has non numeric element '+e+". Make sure that all elements are numbers.")}):W.warn(vn(n)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.'),n}}function Ce(){if(st.isUnminified)return function(n,t){var e=n===!0||n===!1;return e||W.warn(vn(n)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),n}}function _u(n){if(st.isUnminified)return function(t,e){return W.isObject(t)||W.warn(vn(t)+' is a not valid value for "'+e+'" attribute. The value should be an object with properties '+n),t}}var Yi="get",Ki="set",q={addGetterSetter(n,t,e,i,r){q.addGetter(n,t,e),q.addSetter(n,t,i,r),q.addOverloadedGetterSetter(n,t)},addGetter(n,t,e){var i=Yi+W._capitalize(t);n.prototype[i]=n.prototype[i]||function(){var r=this.attrs[t];return r===void 0?e:r}},addSetter(n,t,e,i){var r=Ki+W._capitalize(t);n.prototype[r]||q.overWriteSetter(n,t,e,i)},overWriteSetter(n,t,e,i){var r=Ki+W._capitalize(t);n.prototype[r]=function(o){return e&&o!==void 0&&o!==null&&(o=e.call(this,o,t)),this._setAttr(t,o),i&&i.call(this),this}},addComponentsGetterSetter(n,t,e,i,r){var o=e.length,l=W._capitalize,a=Yi+l(t),h=Ki+l(t),f,s;n.prototype[a]=function(){var d={};for(f=0;f<o;f++)s=e[f],d[s]=this.getAttr(t+l(s));return d};var c=_u(e);n.prototype[h]=function(d){var u=this.attrs[t],p;i&&(d=i.call(this,d)),c&&c.call(this,d,t);for(p in d)!d.hasOwnProperty(p)||this._setAttr(t+l(p),d[p]);return this._fireChangeEvent(t,u,d),r&&r.call(this),this},q.addOverloadedGetterSetter(n,t)},addOverloadedGetterSetter(n,t){var e=W._capitalize(t),i=Ki+e,r=Yi+e;n.prototype[t]=function(){return arguments.length?(this[i](arguments[0]),this):this[r]()}},addDeprecatedGetterSetter(n,t,e,i){W.error("Adding deprecated "+t);var r=Yi+W._capitalize(t),o=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";n.prototype[r]=function(){W.error(o);var l=this.attrs[t];return l===void 0?e:l},q.addSetter(n,t,i,function(){W.error(o)}),q.addOverloadedGetterSetter(n,t)},backCompat(n,t){W.each(t,function(e,i){var r=n.prototype[i],o=Yi+W._capitalize(e),l=Ki+W._capitalize(e);function a(){r.apply(this,arguments),W.error('"'+e+'" method is deprecated and will be removed soon. Use ""'+i+'" instead.')}n.prototype[e]=a,n.prototype[o]=a,n.prototype[l]=a})},afterSetFilter(){this._filterUpToDate=!1}};function Sm(n){var t=[],e=n.length,i=W,r,o;for(r=0;r<e;r++)o=n[r],i._isNumber(o)?o=Math.round(o*1e3)/1e3:i._isString(o)||(o=o+""),t.push(o);return t}var Cu=",",Am="(",Em=")",Tm="([",xm="])",km=";",Dm="()",Lm="=",Su=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],Pm=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"],Om=100,li=class{constructor(t){this.canvas=t,this._context=t._canvas.getContext("2d"),st.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(t,e){var i=this.traceArr,r=i.length,o="",l,a,h,f;for(l=0;l<r;l++)a=i[l],h=a.method,h?(f=a.args,o+=h,t?o+=Dm:W._isArray(f[0])?o+=Tm+f.join(Cu)+xm:(e&&(f=f.map(s=>typeof s=="number"?Math.floor(s):s)),o+=Am+f.join(Cu)+Em)):(o+=a.property,t||(o+=Lm+a.val)),o+=km;return o}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr,i;e.push(t),i=e.length,i>=Om&&e.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){var e=t.getLineCap();e&&this.setAttr("lineCap",e)}_applyOpacity(t){var e=t.getAbsoluteOpacity();e!==1&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){var e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,i,r,o,l){this._context.arc(t,e,i,r,o,l)}arcTo(t,e,i,r,o){this._context.arcTo(t,e,i,r,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,i,r,o,l){this._context.bezierCurveTo(t,e,i,r,o,l)}clearRect(t,e,i,r){this._context.clearRect(t,e,i,r)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(t,e){var i=arguments;if(i.length===2)return this._context.createImageData(t,e);if(i.length===1)return this._context.createImageData(t)}createLinearGradient(t,e,i,r){return this._context.createLinearGradient(t,e,i,r)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,i,r,o,l){return this._context.createRadialGradient(t,e,i,r,o,l)}drawImage(t,e,i,r,o,l,a,h,f){var s=arguments,c=this._context;s.length===3?c.drawImage(t,e,i):s.length===5?c.drawImage(t,e,i,r,o):s.length===9&&c.drawImage(t,e,i,r,o,l,a,h,f)}ellipse(t,e,i,r,o,l,a,h){this._context.ellipse(t,e,i,r,o,l,a,h)}isPointInPath(t,e){return this._context.isPointInPath(t,e)}fill(t){t?this._context.fill(t):this._context.fill()}fillRect(t,e,i,r){this._context.fillRect(t,e,i,r)}strokeRect(t,e,i,r){this._context.strokeRect(t,e,i,r)}fillText(t,e,i,r){r?this._context.fillText(t,e,i,r):this._context.fillText(t,e,i)}measureText(t){return this._context.measureText(t)}getImageData(t,e,i,r){return this._context.getImageData(t,e,i,r)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,i,r){this._context.rect(t,e,i,r)}putImageData(t,e,i){this._context.putImageData(t,e,i)}quadraticCurveTo(t,e,i,r){this._context.quadraticCurveTo(t,e,i,r)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,i,r,o,l){this._context.setTransform(t,e,i,r,o,l)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,i,r){this._context.strokeText(t,e,i,r)}transform(t,e,i,r,o,l){this._context.transform(t,e,i,r,o,l)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t=this,e=Su.length,i=this.setAttr,r,o,l=function(a){var h=t[a],f;t[a]=function(){return o=Sm(Array.prototype.slice.call(arguments,0)),f=h.apply(t,arguments),t._trace({method:a,args:o}),f}};for(r=0;r<e;r++)l(Su[r]);t.setAttr=function(){i.apply(t,arguments);var a=arguments[0],h=arguments[1];(a==="shadowOffsetX"||a==="shadowOffsetY"||a==="shadowBlur")&&(h=h/this.canvas.getPixelRatio()),t._trace({property:a,val:h})}}_applyGlobalCompositeOperation(t){let e=t.attrs.globalCompositeOperation;var i=!e||e==="source-over";i||this.setAttr("globalCompositeOperation",e)}};Pm.forEach(function(n){Object.defineProperty(li.prototype,n,{get(){return this._context[n]},set(t){this._context[n]=t}})});var da=class extends li{_fillColor(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){var e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){var e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){var e=t.fill(),i=t.getFillPriority();if(e&&i==="color"){this._fillColor(t);return}var r=t.getFillPatternImage();if(r&&i==="pattern"){this._fillPattern(t);return}var o=t.getFillLinearGradientColorStops();if(o&&i==="linear-gradient"){this._fillLinearGradient(t);return}var l=t.getFillRadialGradientColorStops();if(l&&i==="radial-gradient"){this._fillRadialGradient(t);return}e?this._fillColor(t):r?this._fillPattern(t):o?this._fillLinearGradient(t):l&&this._fillRadialGradient(t)}_strokeLinearGradient(t){var e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),r=t.getStrokeLinearGradientColorStops(),o=this.createLinearGradient(e.x,e.y,i.x,i.y);if(r){for(var l=0;l<r.length;l+=2)o.addColorStop(r[l],r[l+1]);this.setAttr("strokeStyle",o)}}_stroke(t){var e=t.dash(),i=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!i){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");var o=t.getStrokeLinearGradientColorStops();o?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore()}}_applyShadow(t){var e,i,r,o=(e=t.getShadowRGBA())!==null&&e!==void 0?e:"black",l=(i=t.getShadowBlur())!==null&&i!==void 0?i:5,a=(r=t.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},h=t.getAbsoluteScale(),f=this.canvas.getPixelRatio(),s=h.x*f,c=h.y*f;this.setAttr("shadowColor",o),this.setAttr("shadowBlur",l*Math.min(Math.abs(s),Math.abs(c))),this.setAttr("shadowOffsetX",a.x*s),this.setAttr("shadowOffsetY",a.y*c)}},fa=class extends li{_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){var e=t.getStrokeScaleEnabled();if(!e){this.save();var i=this.getCanvas().getPixelRatio();this.setTransform(i,0,0,i,0,0)}this._applyLineCap(t);var r=t.hitStrokeWidth(),o=r==="auto"?t.strokeWidth():r;this.setAttr("lineWidth",o),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),e||this.restore()}}};var eo;function Mm(){if(eo)return eo;var n=W.createCanvasElement(),t=n.getContext("2d");return eo=function(){var e=st._global.devicePixelRatio||1,i=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return e/i}(),eo}var ci=class{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=t||{},i=e.pixelRatio||st.pixelRatio||Mm();this.pixelRatio=i,this._canvas=W.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio,i=this.getContext()._context;i.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio,i=this.getContext()._context;i.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch{try{return this._canvas.toDataURL()}catch(r){return W.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}};q.addGetterSetter(ci,"pixelRatio",void 0,ht());var Ze=class extends ci{constructor(t={width:0,height:0}){super(t);this.context=new da(this),this.setSize(t.width,t.height)}},jn=class extends ci{constructor(t={width:0,height:0}){super(t);this.hitCanvas=!0,this.context=new fa(this),this.setSize(t.width,t.height)}};var yt={get isDragging(){var n=!1;return yt._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(n=!0)}),n},justDragged:!1,get node(){var n;return yt._dragElements.forEach(t=>{n=t.node}),n},_dragElements:new Map,_drag(n){let t=[];yt._dragElements.forEach((e,i)=>{let{node:r}=e,o=r.getStage();o.setPointersPositions(n),e.pointerId===void 0&&(e.pointerId=W._getFirstPointerId(n));let l=o._changedPointerPositions.find(f=>f.id===e.pointerId);if(!!l){if(e.dragStatus!=="dragging"){var a=r.dragDistance(),h=Math.max(Math.abs(l.x-e.startPointerPos.x),Math.abs(l.y-e.startPointerPos.y));if(h<a||(r.startDrag({evt:n}),!r.isDragging()))return}r._setDragPosition(n,e),t.push(r)}}),t.forEach(e=>{e.fire("dragmove",{type:"dragmove",target:e,evt:n},!0)})},_endDragBefore(n){yt._dragElements.forEach(t=>{let{node:e}=t,i=e.getStage();if(n&&i.setPointersPositions(n),!i._changedPointerPositions.find(l=>l.id===t.pointerId))return;(t.dragStatus==="dragging"||t.dragStatus==="stopped")&&(yt.justDragged=!0,st._mouseListenClick=!1,st._touchListenClick=!1,st._pointerListenClick=!1,t.dragStatus="stopped");let o=t.node.getLayer()||t.node instanceof st.Stage&&t.node;o&&o.batchDraw()})},_endDragAfter(n){yt._dragElements.forEach((t,e)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:n},!0),t.dragStatus!=="dragging"&&yt._dragElements.delete(e)})}};st.isBrowser&&(window.addEventListener("mouseup",yt._endDragBefore,!0),window.addEventListener("touchend",yt._endDragBefore,!0),window.addEventListener("mousemove",yt._drag),window.addEventListener("touchmove",yt._drag),window.addEventListener("mouseup",yt._endDragAfter,!1),window.addEventListener("touchend",yt._endDragAfter,!1));var io="absoluteOpacity",no="allEventListeners",an="absoluteTransform",Au="absoluteScale",Xi="canvas",Im="Change",Rm="children",Nm="konva",pa="listening",Eu="mouseenter",Tu="mouseleave";var xu="set",ku="Shape",ro=" ",Du="stage",yn="transform",Fm="Stage",ma="visible",Bm=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(ro),Hm=1,ot=class{constructor(t){this._id=Hm++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===yn||t===an)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,e){var i=this._cache.get(t),r=t===yn||t===an,o=i===void 0||r&&i.dirty===!0;return o&&(i=e.call(this),this._cache.set(t,i)),i}_calculate(t,e,i){if(!this._attachedDepsListeners.get(t)){let r=e.map(o=>o+"Change.konva").join(ro);this.on(r,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,i)}_getCanvasCache(){return this._cache.get(Xi)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===an&&this.fire("absoluteTransformChange")}clearCache(){return this._cache.delete(Xi),this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var e=t||{},i={};(e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0)&&(i=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var r=Math.ceil(e.width||i.width),o=Math.ceil(e.height||i.height),l=e.pixelRatio,a=e.x===void 0?i.x:e.x,h=e.y===void 0?i.y:e.y,f=e.offset||0,s=e.drawBorder||!1,c=e.hitCanvasPixelRatio||1;if(!r||!o){W.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}r+=f*2,o+=f*2,a-=f,h-=f;var d=new Ze({pixelRatio:l,width:r,height:o}),u=new Ze({pixelRatio:l,width:0,height:0}),p=new jn({pixelRatio:c,width:r,height:o}),m=d.getContext(),y=p.getContext();return p.isCache=!0,d.isCache=!0,this._cache.delete(Xi),this._filterUpToDate=!1,e.imageSmoothingEnabled===!1&&(d.getContext()._context.imageSmoothingEnabled=!1,u.getContext()._context.imageSmoothingEnabled=!1),m.save(),y.save(),m.translate(-a,-h),y.translate(-a,-h),this._isUnderCache=!0,this._clearSelfAndDescendantCache(io),this._clearSelfAndDescendantCache(Au),this.drawScene(d,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),y.restore(),s&&(m.save(),m.beginPath(),m.rect(0,0,r,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(Xi,{scene:d,filter:u,hit:p,x:a,y:h}),this._requestDraw(),this}isCached(){return this._cache.has(Xi)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){var i=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],r,o,l,a,h=this.getAbsoluteTransform(e);return i.forEach(function(f){var s=h.point(f);r===void 0&&(r=l=s.x,o=a=s.y),r=Math.min(r,s.x),o=Math.min(o,s.y),l=Math.max(l,s.x),a=Math.max(a,s.y)}),{x:r,y:o,width:l-r,height:a-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);let e=this._getCanvasCache();t.translate(e.x,e.y);var i=this._getCachedSceneCanvas(),r=i.pixelRatio;t.drawImage(i._canvas,0,0,i.width/r,i.height/r),t.restore()}_drawCachedHitCanvas(t){var e=this._getCanvasCache(),i=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(i._canvas,0,0,i.width/i.pixelRatio,i.height/i.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),e=this._getCanvasCache(),i=e.scene,r=e.filter,o=r.getContext(),l,a,h,f;if(t){if(!this._filterUpToDate){var s=i.pixelRatio;r.setSize(i.width/i.pixelRatio,i.height/i.pixelRatio);try{for(l=t.length,o.clear(),o.drawImage(i._canvas,0,0,i.getWidth()/s,i.getHeight()/s),a=o.getImageData(0,0,r.getWidth(),r.getHeight()),h=0;h<l;h++){if(f=t[h],typeof f!="function"){W.error("Filter should be type of function, but got "+typeof f+" instead. Please check correct filters");continue}f.call(this,a),o.putImageData(a,0,0)}}catch(c){W.error("Unable to apply filter. "+c.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return r}return i}on(t,e){if(this._cache&&this._cache.delete(no),arguments.length===3)return this._delegate.apply(this,arguments);var i=t.split(ro),r=i.length,o,l,a,h,f;for(o=0;o<r;o++)l=i[o],a=l.split("."),h=a[0],f=a[1]||"",this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:f,handler:e});return this}off(t,e){var i=(t||"").split(ro),r=i.length,o,l,a,h,f,s;if(this._cache&&this._cache.delete(no),!t)for(l in this.eventListeners)this._off(l);for(o=0;o<r;o++)if(a=i[o],h=a.split("."),f=h[0],s=h[1],f)this.eventListeners[f]&&this._off(f,s,e);else for(l in this.eventListeners)this._off(l,s,e);return this}dispatchEvent(t){var e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,function(i){e.call(this,i.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,i){var r=this;this.on(t,function(o){for(var l=o.target.findAncestors(e,!0,r),a=0;a<l.length;a++)o=W.cloneObject(o),o.currentTarget=l[a],i.call(l[a],o)})}remove(){return this.isDragging()&&this.stopDrag(),yt._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(an),this._clearSelfAndDescendantCache(io),this._clearSelfAndDescendantCache(Au),this._clearSelfAndDescendantCache(Du),this._clearSelfAndDescendantCache(ma),this._clearSelfAndDescendantCache(pa)}_remove(){this._clearCaches();var t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this}getAttr(t){var e="get"+W._capitalize(t);return W._isFunction(this[e])?this[e]():this.attrs[t]}getAncestors(){for(var t=this.getParent(),e=[];t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{var e,i;if(!t)return this;for(e in t)e!==Rm&&(i=xu+W._capitalize(e),W._isFunction(this[i])?this[i](t[e]):this._setAttr(e,t[e]))}),this}isListening(){return this._getCache(pa,this._isListening)}_isListening(t){if(!this.listening())return!1;let i=this.getParent();return i&&i!==t&&this!==t?i._isListening(t):!0}isVisible(){return this._getCache(ma,this._isVisible)}_isVisible(t){if(!this.visible())return!1;let i=this.getParent();return i&&i!==t&&this!==t?i._isVisible(t):!0}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);var i=this.getLayer(),r=!1;yt._dragElements.forEach(l=>{l.dragStatus==="dragging"&&(l.node.nodeType==="Stage"||l.node.getLayer()===i)&&(r=!0)});var o=!e&&!st.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),e=this,i=0,r,o,l,a;function h(f){for(r=[],o=f.length,l=0;l<o;l++)a=f[l],i++,a.nodeType!==ku&&(r=r.concat(a.getChildren().slice())),a._id===e._id&&(l=o);r.length>0&&r[0].getDepth()<=t&&h(r)}return e.nodeType!==Fm&&h(e.getStage().getChildren()),i}getDepth(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(yn),this._clearSelfAndDescendantCache(an)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var e=this.getAbsoluteTransform().copy();return e.invert(),e.point(t)}getAbsolutePosition(t){let e=!1,i=this.parent;for(;i;){if(i.isCached()){e=!0;break}i=i.parent}e&&!t&&(t=!0);var r=this.getAbsoluteTransform(t).getMatrix(),o=new De,l=this.offset();return o.m=r.slice(),o.translate(l.x,l.y),o.getTranslation()}setAbsolutePosition(t){var e=this._clearTransform();this.attrs.x=e.x,this.attrs.y=e.y,delete e.x,delete e.y,this._clearCache(yn);var i=this._getAbsoluteTransform().copy();return i.invert(),i.translate(t.x,t.y),t={x:this.attrs.x+i.getTranslation().x,y:this.attrs.y+i.getTranslation().y},this._setTransform(e),this.setPosition({x:t.x,y:t.y}),this._clearCache(yn),this._clearSelfAndDescendantCache(an),this}_setTransform(t){var e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var e=t.x,i=t.y,r=this.x(),o=this.y();return e!==void 0&&(r+=e),i!==void 0&&(o+=i),this.setPosition({x:r,y:o}),this}_eachAncestorReverse(t,e){var i=[],r=this.getParent(),o,l;if(!(e&&e._id===this._id)){for(i.unshift(this);r&&(!e||r._id!==e._id);)i.unshift(r),r=r.parent;for(o=i.length,l=0;l<o;l++)t(i[l])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return W.warn("Node has no parent. moveToTop function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return W.warn("Node has no parent. moveUp function is ignored."),!1;var t=this.index,e=this.parent.getChildren().length;return t<e-1?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return W.warn("Node has no parent. moveDown function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return W.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return W.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&W.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(io,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},e=this.getAttrs(),i,r,o,l,a;t.attrs={};for(i in e)r=e[i],a=W.isObject(r)&&!W._isPlainObject(r)&&!W._isArray(r),!a&&(o=typeof this[i]=="function"&&this[i],delete e[i],l=o?o.call(this):null,e[i]=r,l!==r&&(t.attrs[i]=r));return t.className=this.getClassName(),W._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,i){var r=[];e&&this._isMatch(t)&&r.push(this);for(var o=this.parent;o;){if(o===i)return r;o._isMatch(t)&&r.push(o),o=o.parent}return r}isAncestorOf(t){return!1}findAncestor(t,e,i){return this.findAncestors(t,e,i)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var e=t.replace(/ /g,"").split(","),i=e.length,r,o;for(r=0;r<i;r++)if(o=e[r],W.isValidSelector(o)||(W.warn('Selector "'+o+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),W.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),W.warn("Konva is awesome, right?")),o.charAt(0)==="#"){if(this.id()===o.slice(1))return!0}else if(o.charAt(0)==="."){if(this.hasName(o.slice(1)))return!0}else if(this.className===o||this.nodeType===o)return!0;return!1}getLayer(){var t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(Du,this._getStage)}_getStage(){var t=this.getParent();if(t)return t.getStage()}fire(t,e={},i){return e.target=e.target||this,i?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(an,this._getAbsoluteTransform)}_getAbsoluteTransform(t){var e;if(t)return e=new De,this._eachAncestorReverse(function(r){var o=r.transformsEnabled();o==="all"?e.multiply(r.getTransform()):o==="position"&&e.translate(r.x()-r.offsetX(),r.y()-r.offsetY())},t),e;e=this._cache.get(an)||new De,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();var i=this.transformsEnabled();if(i==="all")e.multiply(this.getTransform());else if(i==="position"){let r=this.attrs.x||0,o=this.attrs.y||0,l=this.attrs.offsetX||0,a=this.attrs.offsetY||0;e.translate(r-l,o-a)}return e.dirty=!1,e}getAbsoluteScale(t){for(var e=this;e;)e._isUnderCache&&(t=e),e=e.getParent();let r=this.getAbsoluteTransform(t).decompose();return{x:r.scaleX,y:r.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(yn,this._getTransform)}_getTransform(){var t,e,i=this._cache.get(yn)||new De;i.reset();var r=this.x(),o=this.y(),l=st.getAngle(this.rotation()),a=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,h=(e=this.attrs.scaleY)!==null&&e!==void 0?e:1,f=this.attrs.skewX||0,s=this.attrs.skewY||0,c=this.attrs.offsetX||0,d=this.attrs.offsetY||0;return(r!==0||o!==0)&&i.translate(r,o),l!==0&&i.rotate(l),(f!==0||s!==0)&&i.skew(f,s),(a!==1||h!==1)&&i.scale(a,h),(c!==0||d!==0)&&i.translate(-1*c,-1*d),i.dirty=!1,i}clone(t){var e=W.cloneObject(this.attrs),i,r,o,l,a;for(i in t)e[i]=t[i];var h=new this.constructor(e);for(i in this.eventListeners)for(r=this.eventListeners[i],o=r.length,l=0;l<o;l++)a=r[l],a.name.indexOf(Nm)<0&&(h.eventListeners[i]||(h.eventListeners[i]=[]),h.eventListeners[i].push(a));return h}_toKonvaCanvas(t){t=t||{};var e=this.getClientRect(),i=this.getStage(),r=t.x!==void 0?t.x:e.x,o=t.y!==void 0?t.y:e.y,l=t.pixelRatio||1,a=new Ze({width:t.width||e.width||(i?i.width():0),height:t.height||e.height||(i?i.height():0),pixelRatio:l}),h=a.getContext();return h.save(),(r||o)&&h.translate(-1*r,-1*o),this.drawScene(a),h.restore(),a}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};var e=t.mimeType||null,i=t.quality||null,r=this._toKonvaCanvas(t).toDataURL(e,i);return t.callback&&t.callback(r),r}toImage(t){if(!t||!t.callback)throw"callback required for toImage method config argument";var e=t.callback;delete t.callback,W._urlToImage(this.toDataURL(t),function(i){e(i)})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():st.dragDistance}_off(t,e,i){var r=this.eventListeners[t],o,l,a;for(o=0;o<r.length;o++)if(l=r[o].name,a=r[o].handler,(l!=="konva"||e==="konva")&&(!e||l===e)&&(!i||i===a)){if(r.splice(o,1),r.length===0){delete this.eventListeners[t];break}o--}}_fireChangeEvent(t,e,i){this._fire(t+Im,{oldVal:e,newVal:i})}addName(t){if(!this.hasName(t)){var e=this.name(),i=e?e+" "+t:t;this.name(i)}return this}hasName(t){if(!t)return!1;let e=this.name();if(!e)return!1;var i=(e||"").split(/\s/g);return i.indexOf(t)!==-1}removeName(t){var e=(this.name()||"").split(/\s/g),i=e.indexOf(t);return i!==-1&&(e.splice(i,1),this.name(e.join(" "))),this}setAttr(t,e){var i=this[xu+W._capitalize(t)];return W._isFunction(i)?i.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(st.autoDrawEnabled){let t=this.getLayer()||this.getStage();t==null||t.batchDraw()}}_setAttr(t,e){var i=this.attrs[t];i===e&&!W.isObject(e)||(e==null?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,i,e),this._requestDraw())}_setComponentAttr(t,e,i){var r;i!==void 0&&(r=this.attrs[t],r||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=i,this._fireChangeEvent(t,r,i))}_fireAndBubble(t,e,i){e&&this.nodeType===ku&&(e.target=this);var r=(t===Eu||t===Tu)&&(i&&(this===i||this.isAncestorOf&&this.isAncestorOf(i))||this.nodeType==="Stage"&&!i);if(!r){this._fire(t,e);var o=(t===Eu||t===Tu)&&i&&i.isAncestorOf&&i.isAncestorOf(this)&&!i.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!o&&(i&&i.parent?this._fireAndBubble.call(this.parent,t,e,i):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){let e=this._cache.get(no);if(!e){e={};let r=Object.getPrototypeOf(this);for(;r;){if(!r.eventListeners){r=Object.getPrototypeOf(r);continue}for(var i in r.eventListeners){let o=r.eventListeners[i],l=e[i]||[];e[i]=o.concat(l)}r=Object.getPrototypeOf(r)}this._cache.set(no,e)}return e[t]}_fire(t,e){e=e||{},e.currentTarget=this,e.type=t;let i=this._getProtoListeners(t);if(i)for(var r=0;r<i.length;r++)i[r].handler.call(this,e);let o=this.eventListeners[t];if(o)for(var r=0;r<o.length;r++)o[r].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){var e=t?t.pointerId:void 0,i=this.getStage(),r=this.getAbsolutePosition(),o=i._getPointerById(e)||i._changedPointerPositions[0]||r;yt._dragElements.set(this._id,{node:this,startPointerPos:o,offset:{x:o.x-r.x,y:o.y-r.y},dragStatus:"ready",pointerId:e})}startDrag(t,e=!0){yt._dragElements.has(this._id)||this._createDragElement(t);let i=yt._dragElements.get(this._id);i.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){let i=this.getStage()._getPointerById(e.pointerId);if(!!i){var r={x:i.x-e.offset.x,y:i.y-e.offset.y},o=this.dragBoundFunc();if(o!==void 0){let l=o.call(this,r,t);l?r=l:W.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==r.x||this._lastPos.y!==r.y)&&(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(t){let e=yt._dragElements.get(this._id);e&&(e.dragStatus="stopped"),yt._endDragBefore(t),yt._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){let t=yt._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){var e=t.evt.button!==void 0,i=!e||st.dragButtons.indexOf(t.evt.button)>=0;if(!!i&&!this.isDragging()){var r=!1;yt._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(r=!0)}),r||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;let e=yt._dragElements.get(this._id),i=e&&e.dragStatus==="dragging",r=e&&e.dragStatus==="ready";i?this.stopDrag():r&&yt._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){let e=this.getStage();if(!e)return!1;let i={x:-t.x,y:-t.y,width:e.width()+t.x,height:e.height()+t.y};return W.haveIntersection(i,this.getClientRect())}static create(t,e){return W._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){var i=ot.prototype.getClassName.call(t),r=t.children,o,l,a;e&&(t.attrs.container=e),st[i]||(W.warn('Can not find a node with class name "'+i+'". Fallback to "Shape".'),i="Shape");let h=st[i];if(o=new h(t.attrs),r)for(l=r.length,a=0;a<l;a++)o.add(ot._createNode(r[a]));return o}};ot.prototype.nodeType="Node";ot.prototype._attrsAffectingSize=[];ot.prototype.eventListeners={};ot.prototype.on.call(ot.prototype,Bm,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(yn),this._clearSelfAndDescendantCache(an)});ot.prototype.on.call(ot.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(ma)});ot.prototype.on.call(ot.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(pa)});ot.prototype.on.call(ot.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(io)});var Tt=q.addGetterSetter;Tt(ot,"zIndex");Tt(ot,"absolutePosition");Tt(ot,"position");Tt(ot,"x",0,ht());Tt(ot,"y",0,ht());Tt(ot,"globalCompositeOperation","source-over",sn());Tt(ot,"opacity",1,ht());Tt(ot,"name","",sn());Tt(ot,"id","",sn());Tt(ot,"rotation",0,ht());q.addComponentsGetterSetter(ot,"scale",["x","y"]);Tt(ot,"scaleX",1,ht());Tt(ot,"scaleY",1,ht());q.addComponentsGetterSetter(ot,"skew",["x","y"]);Tt(ot,"skewX",0,ht());Tt(ot,"skewY",0,ht());q.addComponentsGetterSetter(ot,"offset",["x","y"]);Tt(ot,"offsetX",0,ht());Tt(ot,"offsetY",0,ht());Tt(ot,"dragDistance",null,ht());Tt(ot,"width",0,ht());Tt(ot,"height",0,ht());Tt(ot,"listening",!0,Ce());Tt(ot,"preventDefault",!0,Ce());Tt(ot,"filters",null,function(n){return this._filterUpToDate=!1,n});Tt(ot,"visible",!0,Ce());Tt(ot,"transformsEnabled","all",sn());Tt(ot,"size");Tt(ot,"dragBoundFunc");Tt(ot,"draggable",!1,Ce());q.backCompat(ot,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var $i=new Map,Lu=st._global.PointerEvent!==void 0;function oo(n){return $i.get(n)}function so(n){return{evt:n,pointerId:n.pointerId}}function ao(n,t){return $i.get(n)===t}function lo(n,t){Vn(n),!!t.getStage()&&($i.set(n,t),Lu&&t._fire("gotpointercapture",so(new PointerEvent("gotpointercapture"))))}function Vn(n,t){let e=$i.get(n);if(!e)return;let i=e.getStage();i&&i.content,$i.delete(n),Lu&&e._fire("lostpointercapture",so(new PointerEvent("lostpointercapture")))}var Ou="hasShadow",Mu="shadowRGBA",Iu="patternImage",Ru="linearGradient",Nu="radialGradient",co;function ga(){return co||(co=W.createCanvasElement().getContext("2d"),co)}var Un={};function Wm(n){n.fill()}function jm(n){n.stroke()}function Vm(n){n.fill()}function Um(n){n.stroke()}function Gm(){this._clearCache(Ou)}function zm(){this._clearCache(Mu)}function qm(){this._clearCache(Iu)}function Ym(){this._clearCache(Ru)}function Km(){this._clearCache(Nu)}var J=class extends ot{constructor(t){super(t);let e;for(;e=W.getRandomColor(),!(e&&!(e in Un)););this.colorKey=e,Un[e]=this}getContext(){return W.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return W.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(Ou,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Iu,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var t=ga();let e=t.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){let i=new De;i.translate(this.fillPatternX(),this.fillPatternY()),i.rotate(st.getAngle(this.fillPatternRotation())),i.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),i.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());let r=i.getMatrix();e.setTransform({a:r[0],b:r[1],c:r[2],d:r[3],e:r[4],f:r[5]})}return e}}_getLinearGradient(){return this._getCache(Ru,this.__getLinearGradient)}__getLinearGradient(){var t=this.fillLinearGradientColorStops();if(t){for(var e=ga(),i=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),o=e.createLinearGradient(i.x,i.y,r.x,r.y),l=0;l<t.length;l+=2)o.addColorStop(t[l],t[l+1]);return o}}_getRadialGradient(){return this._getCache(Nu,this.__getRadialGradient)}__getRadialGradient(){var t=this.fillRadialGradientColorStops();if(t){for(var e=ga(),i=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),o=e.createRadialGradient(i.x,i.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius()),l=0;l<t.length;l+=2)o.addColorStop(t[l],t[l+1]);return o}}getShadowRGBA(){return this._getCache(Mu,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var t=W.colorToRGBA(this.shadowColor());return"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")"}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){let t=this.hitStrokeWidth();return t==="auto"?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){var e=this.getStage(),i=e.bufferHitCanvas,r;return i.getContext().clear(),this.drawHit(i,null,!0),r=i.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data,r[3]>0}destroy(){return ot.prototype.destroy.call(this),delete Un[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;if(!this.getStage()||!((e=this.attrs.perfectDrawEnabled)!==null&&e!==void 0?e:!0))return!1;let r=t||this.hasFill(),o=this.hasStroke(),l=this.getAbsoluteOpacity()!==1;if(r&&o&&l)return!0;let a=this.hasShadow(),h=this.shadowForStrokeEnabled();return!!(r&&o&&a&&h)}setStrokeHitEnabled(t){W.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){let e=t.skipTransform,i=t.relativeTo,r=this.getSelfRect(),l=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,a=r.width+l,h=r.height+l,f=!t.skipShadow&&this.hasShadow(),s=f?this.shadowOffsetX():0,c=f?this.shadowOffsetY():0,d=a+Math.abs(s),u=h+Math.abs(c),p=f&&this.shadowBlur()||0,m=d+p*2,y=u+p*2,g=0;Math.round(l/2)!==l/2&&(g=1);let v={width:m+g,height:y+g,x:-Math.round(l/2+p)+Math.min(s,0)+r.x,y:-Math.round(l/2+p)+Math.min(c,0)+r.y};return e?v:this._transformedRect(v,i)}drawScene(t,e){var i=this.getLayer(),r=t||i.getCanvas(),o=r.getContext(),l=this._getCanvasCache(),a=this.getSceneFunc(),h=this.hasShadow(),f,s,c,d=r.isCache,u=e===this;if(!this.isVisible()&&!u)return this;if(l){o.save();var p=this.getAbsoluteTransform(e).getMatrix();return o.transform(p[0],p[1],p[2],p[3],p[4],p[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!a)return this;if(o.save(),this._useBufferCanvas()&&!d){f=this.getStage(),s=f.bufferCanvas,c=s.getContext(),c.clear(),c.save(),c._applyLineJoin(this);var m=this.getAbsoluteTransform(e).getMatrix();c.transform(m[0],m[1],m[2],m[3],m[4],m[5]),a.call(this,c,this),c.restore();var y=s.pixelRatio;h&&o._applyShadow(this),o._applyOpacity(this),o._applyGlobalCompositeOperation(this),o.drawImage(s._canvas,0,0,s.width/y,s.height/y)}else{if(o._applyLineJoin(this),!u){var m=this.getAbsoluteTransform(e).getMatrix();o.transform(m[0],m[1],m[2],m[3],m[4],m[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}h&&o._applyShadow(this),a.call(this,o,this)}return o.restore(),this}drawHit(t,e,i=!1){if(!this.shouldDrawHit(e,i))return this;var r=this.getLayer(),o=t||r.hitCanvas,l=o&&o.getContext(),a=this.hitFunc()||this.sceneFunc(),h=this._getCanvasCache(),f=h&&h.hit;if(this.colorKey||W.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),f){l.save();var s=this.getAbsoluteTransform(e).getMatrix();return l.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(l),l.restore(),this}if(!a)return this;if(l.save(),l._applyLineJoin(this),!(this===e)){var d=this.getAbsoluteTransform(e).getMatrix();l.transform(d[0],d[1],d[2],d[3],d[4],d[5])}return a.call(this,l,this),l.restore(),this}drawHitFromCache(t=0){var e=this._getCanvasCache(),i=this._getCachedSceneCanvas(),r=e.hit,o=r.getContext(),l=r.getWidth(),a=r.getHeight(),h,f,s,c,d,u;o.clear(),o.drawImage(i._canvas,0,0,l,a);try{for(h=o.getImageData(0,0,l,a),f=h.data,s=f.length,c=W._hexToRgb(this.colorKey),d=0;d<s;d+=4)u=f[d+3],u>t?(f[d]=c.r,f[d+1]=c.g,f[d+2]=c.b,f[d+3]=255):f[d+3]=0;o.putImageData(h,0,0)}catch(p){W.error("Unable to draw hit graph from cached scene canvas. "+p.message)}return this}hasPointerCapture(t){return ao(t,this)}setPointerCapture(t){lo(t,this)}releaseCapture(t){Vn(t,this)}};J.prototype._fillFunc=Wm;J.prototype._strokeFunc=jm;J.prototype._fillFuncHit=Vm;J.prototype._strokeFuncHit=Um;J.prototype._centroid=!1;J.prototype.nodeType="Shape";se(J);J.prototype.eventListeners={};J.prototype.on.call(J.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",Gm);J.prototype.on.call(J.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",zm);J.prototype.on.call(J.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",qm);J.prototype.on.call(J.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",Ym);J.prototype.on.call(J.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",Km);q.addGetterSetter(J,"stroke",void 0,ha());q.addGetterSetter(J,"strokeWidth",2,ht());q.addGetterSetter(J,"fillAfterStrokeEnabled",!1);q.addGetterSetter(J,"hitStrokeWidth","auto",qi());q.addGetterSetter(J,"strokeHitEnabled",!0,Ce());q.addGetterSetter(J,"perfectDrawEnabled",!0,Ce());q.addGetterSetter(J,"shadowForStrokeEnabled",!0,Ce());q.addGetterSetter(J,"lineJoin");q.addGetterSetter(J,"lineCap");q.addGetterSetter(J,"sceneFunc");q.addGetterSetter(J,"hitFunc");q.addGetterSetter(J,"dash");q.addGetterSetter(J,"dashOffset",0,ht());q.addGetterSetter(J,"shadowColor",void 0,sn());q.addGetterSetter(J,"shadowBlur",0,ht());q.addGetterSetter(J,"shadowOpacity",1,ht());q.addComponentsGetterSetter(J,"shadowOffset",["x","y"]);q.addGetterSetter(J,"shadowOffsetX",0,ht());q.addGetterSetter(J,"shadowOffsetY",0,ht());q.addGetterSetter(J,"fillPatternImage");q.addGetterSetter(J,"fill",void 0,ha());q.addGetterSetter(J,"fillPatternX",0,ht());q.addGetterSetter(J,"fillPatternY",0,ht());q.addGetterSetter(J,"fillLinearGradientColorStops");q.addGetterSetter(J,"strokeLinearGradientColorStops");q.addGetterSetter(J,"fillRadialGradientStartRadius",0);q.addGetterSetter(J,"fillRadialGradientEndRadius",0);q.addGetterSetter(J,"fillRadialGradientColorStops");q.addGetterSetter(J,"fillPatternRepeat","repeat");q.addGetterSetter(J,"fillEnabled",!0);q.addGetterSetter(J,"strokeEnabled",!0);q.addGetterSetter(J,"shadowEnabled",!0);q.addGetterSetter(J,"dashEnabled",!0);q.addGetterSetter(J,"strokeScaleEnabled",!0);q.addGetterSetter(J,"fillPriority","color");q.addComponentsGetterSetter(J,"fillPatternOffset",["x","y"]);q.addGetterSetter(J,"fillPatternOffsetX",0,ht());q.addGetterSetter(J,"fillPatternOffsetY",0,ht());q.addComponentsGetterSetter(J,"fillPatternScale",["x","y"]);q.addGetterSetter(J,"fillPatternScaleX",1,ht());q.addGetterSetter(J,"fillPatternScaleY",1,ht());q.addComponentsGetterSetter(J,"fillLinearGradientStartPoint",["x","y"]);q.addComponentsGetterSetter(J,"strokeLinearGradientStartPoint",["x","y"]);q.addGetterSetter(J,"fillLinearGradientStartPointX",0);q.addGetterSetter(J,"strokeLinearGradientStartPointX",0);q.addGetterSetter(J,"fillLinearGradientStartPointY",0);q.addGetterSetter(J,"strokeLinearGradientStartPointY",0);q.addComponentsGetterSetter(J,"fillLinearGradientEndPoint",["x","y"]);q.addComponentsGetterSetter(J,"strokeLinearGradientEndPoint",["x","y"]);q.addGetterSetter(J,"fillLinearGradientEndPointX",0);q.addGetterSetter(J,"strokeLinearGradientEndPointX",0);q.addGetterSetter(J,"fillLinearGradientEndPointY",0);q.addGetterSetter(J,"strokeLinearGradientEndPointY",0);q.addComponentsGetterSetter(J,"fillRadialGradientStartPoint",["x","y"]);q.addGetterSetter(J,"fillRadialGradientStartPointX",0);q.addGetterSetter(J,"fillRadialGradientStartPointY",0);q.addComponentsGetterSetter(J,"fillRadialGradientEndPoint",["x","y"]);q.addGetterSetter(J,"fillRadialGradientEndPointX",0);q.addGetterSetter(J,"fillRadialGradientEndPointY",0);q.addGetterSetter(J,"fillPatternRotation",0);q.backCompat(J,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});function va(n,t,e,i,r,o,l){var a=Math.sqrt(Math.pow(e-n,2)+Math.pow(i-t,2)),h=Math.sqrt(Math.pow(r-e,2)+Math.pow(o-i,2)),f=l*a/(a+h),s=l*h/(a+h),c=e-f*(r-n),d=i-f*(o-t),u=e+s*(r-n),p=i+s*(o-t);return[c,d,u,p]}function Fu(n,t){var e=n.length,i=[],r,o;for(r=2;r<e-2;r+=2)o=va(n[r-2],n[r-1],n[r],n[r+1],n[r+2],n[r+3],t),!isNaN(o[0])&&(i.push(o[0]),i.push(o[1]),i.push(n[r]),i.push(n[r+1]),i.push(o[2]),i.push(o[3]));return i}var Le=class extends J{constructor(t){super(t);this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(t){var e=this.points(),i=e.length,r=this.tension(),o=this.closed(),l=this.bezier(),a,h,f;if(!!i){if(t.beginPath(),t.moveTo(e[0],e[1]),r!==0&&i>4){for(a=this.getTensionPoints(),h=a.length,f=o?0:4,o||t.quadraticCurveTo(a[0],a[1],a[2],a[3]);f<h-2;)t.bezierCurveTo(a[f++],a[f++],a[f++],a[f++],a[f++],a[f++]);o||t.quadraticCurveTo(a[h-2],a[h-1],e[i-2],e[i-1])}else if(l)for(f=2;f<i;)t.bezierCurveTo(e[f++],e[f++],e[f++],e[f++],e[f++],e[f++]);else for(f=2;f<i;f+=2)t.lineTo(e[f],e[f+1]);o?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():Fu(this.points(),this.tension())}_getTensionPointsClosed(){var t=this.points(),e=t.length,i=this.tension(),r=va(t[e-2],t[e-1],t[0],t[1],t[2],t[3],i),o=va(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],i),l=Fu(t,i),a=[r[2],r[3]].concat(l).concat([o[0],o[1],t[e-2],t[e-1],o[2],o[3],r[0],r[1],t[0],t[1]]);return a}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};this.tension()!==0?t=[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:t=this.points();for(var e=t[0],i=t[0],r=t[1],o=t[1],l,a,h=0;h<t.length/2;h++)l=t[h*2],a=t[h*2+1],e=Math.min(e,l),i=Math.max(i,l),r=Math.min(r,a),o=Math.max(o,a);return{x:e,y:r,width:i-e,height:o-r}}};Le.prototype.className="Line";Le.prototype._attrsAffectingSize=["points","bezier","tension"];se(Le);q.addGetterSetter(Le,"closed",!1);q.addGetterSetter(Le,"bezier",!1);q.addGetterSetter(Le,"tension",0,ht());q.addGetterSetter(Le,"points",[],wu());var bn=class extends J{_sceneFunc(t){var e=this.cornerRadius(),i=this.width(),r=this.height();if(t.beginPath(),!e)t.rect(0,0,i,r);else{let o=0,l=0,a=0,h=0;typeof e=="number"?o=l=a=h=Math.min(e,i/2,r/2):(o=Math.min(e[0]||0,i/2,r/2),l=Math.min(e[1]||0,i/2,r/2),h=Math.min(e[2]||0,i/2,r/2),a=Math.min(e[3]||0,i/2,r/2)),t.moveTo(o,0),t.lineTo(i-l,0),t.arc(i-l,l,l,Math.PI*3/2,0,!1),t.lineTo(i,r-h),t.arc(i-h,r-h,h,0,Math.PI/2,!1),t.lineTo(a,r),t.arc(a,r-a,a,Math.PI/2,Math.PI,!1),t.lineTo(0,o),t.arc(o,o,o,Math.PI,Math.PI*3/2,!1)}t.closePath(),t.fillStrokeShape(this)}};bn.prototype.className="Rect";se(bn);q.addGetterSetter(bn,"cornerRadius",0,bu(4));function Xm(n){return Array.from(n)}var uo="auto",$m="center",Zi="justify",Zm="Change.konva",Jm="2d",Bu="-",Wu="left",Qm="text",tg="Text",eg="top",ng="bottom",Hu="middle",ju="normal",ig="px ",ho=" ",rg="right",og="word",sg="char",ag="none",ya="\u2026",Vu=["fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],lg=Vu.length;function cg(n){return n.split(",").map(t=>{t=t.trim();let e=t.indexOf(" ")>=0,i=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!i&&(t=`"${t}"`),t}).join(", ")}var fo;function ba(){return fo||(fo=W.createCanvasElement().getContext(Jm),fo)}function ug(n){n.fillText(this._partialText,this._partialTextX,this._partialTextY)}function hg(n){n.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function dg(n){return n=n||{},!n.fillLinearGradientColorStops&&!n.fillRadialGradientColorStops&&!n.fillPatternImage&&(n.fill=n.fill||"black"),n}var xt=class extends J{constructor(t){super(dg(t));this._partialTextX=0,this._partialTextY=0;for(var e=0;e<lg;e++)this.on(Vu[e]+Zm,this._setTextData);this._setTextData()}_sceneFunc(t){var e=this.textArr,i=e.length;if(!!this.text()){var r=this.padding(),o=this.fontSize(),l=this.lineHeight()*o,a=this.verticalAlign(),h=0,f=this.align(),s=this.getWidth(),c=this.letterSpacing(),d=this.fill(),u=this.textDecoration(),p=u.indexOf("underline")!==-1,m=u.indexOf("line-through")!==-1,y,g=0,g=l/2,v=0,b=0;for(t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",Hu),t.setAttr("textAlign",Wu),a===Hu?h=(this.getHeight()-i*l-r*2)/2:a===ng&&(h=this.getHeight()-i*l-r*2),t.translate(r,h+r),y=0;y<i;y++){var v=0,b=0,w=e[y],_=w.text,C=w.width,S=y!==i-1,T,I,F;if(t.save(),f===rg?v+=s-C-r*2:f===$m&&(v+=(s-C-r*2)/2),p&&(t.save(),t.beginPath(),t.moveTo(v,g+b+Math.round(o/2)),T=_.split(" ").length-1,I=T===0,F=f===Zi&&S&&!I?s-r*2:C,t.lineTo(v+Math.round(F),g+b+Math.round(o/2)),t.lineWidth=o/15,t.strokeStyle=d,t.stroke(),t.restore()),m&&(t.save(),t.beginPath(),t.moveTo(v,g+b),T=_.split(" ").length-1,I=T===0,F=f===Zi&&S&&!I?s-r*2:C,t.lineTo(v+Math.round(F),g+b),t.lineWidth=o/15,t.strokeStyle=d,t.stroke(),t.restore()),c!==0||f===Zi){T=_.split(" ").length-1;for(var P=Xm(_),L=0;L<P.length;L++){var k=P[L];k===" "&&y!==i-1&&f===Zi&&(v+=(s-r*2-C)/T),this._partialTextX=v,this._partialTextY=g+b,this._partialText=k,t.fillStrokeShape(this),v+=this.measureSize(k).width+c}}else this._partialTextX=v,this._partialTextY=g+b,this._partialText=_,t.fillStrokeShape(this);t.restore(),i>1&&(g+=l)}}}_hitFunc(t){var e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}setText(t){var e=W._isString(t)?t:t==null?"":t+"";return this._setAttr(Qm,e),this}getWidth(){var t=this.attrs.width===uo||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===uo||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return W.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e=ba(),i=this.fontSize(),r;return e.save(),e.font=this._getContextFont(),r=e.measureText(t),e.restore(),{width:r.width,height:i}}_getContextFont(){return this.fontStyle()+ho+this.fontVariant()+ho+(this.fontSize()+ig)+cg(this.fontFamily())}_addTextLine(t){this.align()===Zi&&(t=t.trim());var e=this._getTextWidth(t);return this.textArr.push({text:t,width:e})}_getTextWidth(t){var e=this.letterSpacing(),i=t.length;return ba().measureText(t).width+(i?e*(i-1):0)}_setTextData(){var t=this.text().split(`
`),e=+this.fontSize(),i=0,r=this.lineHeight()*e,o=this.attrs.width,l=this.attrs.height,a=o!==uo&&o!==void 0,h=l!==uo&&l!==void 0,f=this.padding(),s=o-f*2,c=l-f*2,d=0,u=this.wrap(),p=u!==ag,m=u!==sg&&p,y=this.ellipsis();this.textArr=[],ba().font=this._getContextFont();for(var g=y?this._getTextWidth(ya):0,v=0,b=t.length;v<b;++v){var w=t[v],_=this._getTextWidth(w);if(a&&_>s)for(;w.length>0;){for(var C=0,S=w.length,T="",I=0;C<S;){var F=C+S>>>1,P=w.slice(0,F+1),L=this._getTextWidth(P)+g;L<=s?(C=F+1,T=P,I=L):S=F}if(T){if(m){var k,A=w[T.length],E=A===ho||A===Bu;E&&I<=s?k=T.length:k=Math.max(T.lastIndexOf(ho),T.lastIndexOf(Bu))+1,k>0&&(C=k,T=T.slice(0,C),I=this._getTextWidth(T))}if(T=T.trimRight(),this._addTextLine(T),i=Math.max(i,I),d+=r,!p||h&&d+r>c){var O=this.textArr[this.textArr.length-1];if(O&&y){var j=this._getTextWidth(O.text+ya)<s;j||(O.text=O.text.slice(0,O.text.length-3)),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(O.text+ya)}break}if(w=w.slice(C),w=w.trimLeft(),w.length>0&&(_=this._getTextWidth(w),_<=s)){this._addTextLine(w),d+=r,i=Math.max(i,_);break}}else break}else this._addTextLine(w),d+=r,i=Math.max(i,_);if(h&&d+r>c)break}this.textHeight=e,this.textWidth=i}getStrokeScaleEnabled(){return!0}};xt.prototype._fillFunc=ug;xt.prototype._strokeFunc=hg;xt.prototype.className=tg;xt.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];se(xt);q.overWriteSetter(xt,"width",qi());q.overWriteSetter(xt,"height",qi());q.addGetterSetter(xt,"fontFamily","Arial");q.addGetterSetter(xt,"fontSize",12,ht());q.addGetterSetter(xt,"fontStyle",ju);q.addGetterSetter(xt,"fontVariant",ju);q.addGetterSetter(xt,"padding",0,ht());q.addGetterSetter(xt,"align",Wu);q.addGetterSetter(xt,"verticalAlign",eg);q.addGetterSetter(xt,"lineHeight",1,ht());q.addGetterSetter(xt,"wrap",og);q.addGetterSetter(xt,"ellipsis",!1,Ce());q.addGetterSetter(xt,"letterSpacing",0,ht());q.addGetterSetter(xt,"text","",sn());q.addGetterSetter(xt,"textDecoration","");var Zt=class extends ot{constructor(){super(...arguments);this.children=[]}getChildren(t){if(!t)return this.children||[];let e=this.children||[];var i=[];return e.forEach(function(r){t(r)&&i.push(r)}),i}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}var i=t[0];return i.getParent()?(i.moveTo(this),this):(this._validateAdd(i),i.index=this.getChildren().length,i.parent=this,i._clearCaches(),this.getChildren().push(i),this._fire("add",{child:i}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){var i=[];return this._descendants(r=>{let o=r._isMatch(t);return o&&i.push(r),!!(o&&e)}),i}_descendants(t){let e=!1,i=this.getChildren();for(let r of i){if(e=t(r),e)return!0;if(!!r.hasChildren()&&(e=r._descendants(t),e))return!0}return!1}toObject(){var t=ot.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(e=>{t.children.push(e.toObject())}),t}isAncestorOf(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){var e=ot.prototype.clone.call(this,t);return this.getChildren().forEach(function(i){e.add(i.clone())}),e}getAllIntersections(t){var e=[];return this.find("Shape").forEach(function(i){i.isVisible()&&i.intersects(t)&&e.push(i)}),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),!this.isCached()&&((e=this.children)===null||e===void 0||e.forEach(function(i){i._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(e,i){e.index=i}),this._requestDraw()}drawScene(t,e){var i=this.getLayer(),r=t||i&&i.getCanvas(),o=r&&r.getContext(),l=this._getCanvasCache(),a=l&&l.scene,h=r&&r.isCache;if(!this.isVisible()&&!h)return this;if(a){o.save();var f=this.getAbsoluteTransform(e).getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",r,e);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;var i=this.getLayer(),r=t||i&&i.hitCanvas,o=r&&r.getContext(),l=this._getCanvasCache(),a=l&&l.hit;if(a){o.save();var h=this.getAbsoluteTransform(e).getMatrix();o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,e);return this}_drawChildren(t,e,i){var r,o=e&&e.getContext(),l=this.clipWidth(),a=this.clipHeight(),h=this.clipFunc(),f=l&&a||h;let s=i===this;if(f){o.save();var c=this.getAbsoluteTransform(i),d=c.getMatrix();if(o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),o.beginPath(),h)h.call(this,o,this);else{var u=this.clipX(),p=this.clipY();o.rect(u,p,l,a)}o.clip(),d=c.copy().invert().getMatrix(),o.transform(d[0],d[1],d[2],d[3],d[4],d[5])}var m=!s&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(r=this.children)===null||r===void 0||r.forEach(function(y){y[t](e,i)}),m&&o.restore(),f&&o.restore()}getClientRect(t){var e;t=t||{};var i=t.skipTransform,r=t.relativeTo,o,l,a,h,f={x:1/0,y:1/0,width:0,height:0},s=this;(e=this.children)===null||e===void 0||e.forEach(function(m){if(!!m.visible()){var y=m.getClientRect({relativeTo:s,skipShadow:t.skipShadow,skipStroke:t.skipStroke});y.width===0&&y.height===0||(o===void 0?(o=y.x,l=y.y,a=y.x+y.width,h=y.y+y.height):(o=Math.min(o,y.x),l=Math.min(l,y.y),a=Math.max(a,y.x+y.width),h=Math.max(h,y.y+y.height)))}});for(var c=this.find("Shape"),d=!1,u=0;u<c.length;u++){var p=c[u];if(p._isVisible(this)){d=!0;break}}return d&&o!==void 0?f={x:o,y:l,width:a-o,height:h-l}:f={x:0,y:0,width:0,height:0},i?f:this._transformedRect(f,r)}};q.addComponentsGetterSetter(Zt,"clip",["x","y","width","height"]);q.addGetterSetter(Zt,"clipX",void 0,ht());q.addGetterSetter(Zt,"clipY",void 0,ht());q.addGetterSetter(Zt,"clipWidth",void 0,ht());q.addGetterSetter(Zt,"clipHeight",void 0,ht());q.addGetterSetter(Zt,"clipFunc");var fg="Stage",pg="string",Uu="px",mg="mouseout",zu="mouseleave",qu="mouseover",Yu="mouseenter",Ku="mousemove",Xu="mousedown",$u="mouseup",Ji="pointermove",Qi="pointerdown",hi="pointerup",tr="pointercancel",gg="lostpointercapture",po="pointerout",mo="pointerleave",go="pointerover",vo="pointerenter",_a="contextmenu",Zu="touchstart",Ju="touchend",Qu="touchmove",th="touchcancel",Ca="wheel",vg=5,yg=[[Yu,"_pointerenter"],[Xu,"_pointerdown"],[Ku,"_pointermove"],[$u,"_pointerup"],[zu,"_pointerleave"],[Zu,"_pointerdown"],[Qu,"_pointermove"],[Ju,"_pointerup"],[th,"_pointercancel"],[qu,"_pointerover"],[Ca,"_wheel"],[_a,"_contextmenu"],[Qi,"_pointerdown"],[Ji,"_pointermove"],[hi,"_pointerup"],[tr,"_pointercancel"],[gg,"_lostpointercapture"]],wa={mouse:{[po]:mg,[mo]:zu,[go]:qu,[vo]:Yu,[Ji]:Ku,[Qi]:Xu,[hi]:$u,[tr]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[po]:"touchout",[mo]:"touchleave",[go]:"touchover",[vo]:"touchenter",[Ji]:Qu,[Qi]:Zu,[hi]:Ju,[tr]:th,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[po]:po,[mo]:mo,[go]:go,[vo]:vo,[Ji]:Ji,[Qi]:Qi,[hi]:hi,[tr]:tr,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},er=n=>n.indexOf("pointer")>=0?"pointer":n.indexOf("touch")>=0?"touch":"mouse",ui=n=>{let t=er(n);if(t==="pointer")return st.pointerEventsEnabled&&wa.pointer;if(t==="touch")return wa.touch;if(t==="mouse")return wa.mouse};function Gu(n={}){return(n.clipFunc||n.clipWidth||n.clipHeight)&&W.warn("Stage does not support clipping. Please use clip for Layers or Groups."),n}var bg="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);",nr=[],di=class extends Zt{constructor(t){super(Gu(t));this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),nr.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Gu(this.attrs)}),this._checkVisibility()}_validateAdd(t){let e=t.getType()==="Layer",i=t.getType()==="FastLayer";e||i||W.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;let t=this.visible()?"":"none";this.content.style.display=t}setContainer(t){if(typeof t===pg){if(t.charAt(0)==="."){var e=t.slice(1);t=document.getElementsByClassName(e)[0]}else{var i;t.charAt(0)!=="#"?i=t:i=t.slice(1),t=document.getElementById(i)}if(!t)throw"Can not find container in document with id "+i}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var t=this.children,e=t.length,i;for(i=0;i<e;i++)t[i].clear();return this}clone(t){return t||(t={}),t.container=typeof document<"u"&&document.createElement("div"),Zt.prototype.clone.call(this,t)}destroy(){super.destroy();var t=this.content;t&&W._isInDocument(t)&&this.container().removeChild(t);var e=nr.indexOf(this);return e>-1&&nr.splice(e,1),this}getPointerPosition(){let t=this._pointerPositions[0]||this._changedPointerPositions[0];return t?{x:t.x,y:t.y}:(W.warn(bg),null)}_getPointerById(t){return this._pointerPositions.find(e=>e.id===t)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(t){t=t||{},t.x=t.x||0,t.y=t.y||0,t.width=t.width||this.width(),t.height=t.height||this.height();var e=new Ze({width:t.width,height:t.height,pixelRatio:t.pixelRatio||1}),i=e.getContext()._context,r=this.children;return(t.x||t.y)&&i.translate(-1*t.x,-1*t.y),r.forEach(function(o){if(!!o.isVisible()){var l=o._toKonvaCanvas(t);i.drawImage(l._canvas,t.x,t.y,l.getWidth()/l.getPixelRatio(),l.getHeight()/l.getPixelRatio())}}),e}getIntersection(t){if(!t)return null;var e=this.children,i=e.length,r=i-1,o;for(o=r;o>=0;o--){let l=e[o].getIntersection(t);if(l)return l}return null}_resizeDOM(){var t=this.width(),e=this.height();this.content&&(this.content.style.width=t+Uu,this.content.style.height=e+Uu),this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.forEach(i=>{i.setSize({width:t,height:e}),i.draw()})}add(t,...e){if(arguments.length>1){for(var i=0;i<arguments.length;i++)this.add(arguments[i]);return this}super.add(t);var r=this.children.length;return r>vg&&W.warn("The stage has "+r+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),t.setSize({width:this.width(),height:this.height()}),t.draw(),st.isBrowser&&this.content.appendChild(t.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(t){return ao(t,this)}setPointerCapture(t){lo(t,this)}releaseCapture(t){Vn(t,this)}getLayers(){return this.children}_bindContentEvents(){!st.isBrowser||yg.forEach(([t,e])=>{this.content.addEventListener(t,i=>{this[e](i)})})}_pointerenter(t){this.setPointersPositions(t);let e=ui(t.type);this._fire(e.pointerenter,{evt:t,target:this,currentTarget:this})}_pointerover(t){this.setPointersPositions(t);let e=ui(t.type);this._fire(e.pointerover,{evt:t,target:this,currentTarget:this})}_getTargetShape(t){let e=this[t+"targetShape"];return e&&!e.getStage()&&(e=null),e}_pointerleave(t){let e=ui(t.type),i=er(t.type);if(!!e){this.setPointersPositions(t);var r=this._getTargetShape(i),o=!yt.isDragging||st.hitOnDragEnabled;r&&o?(r._fireAndBubble(e.pointerout,{evt:t}),r._fireAndBubble(e.pointerleave,{evt:t}),this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this[i+"targetShape"]=null):o&&(this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this._fire(e.pointerout,{evt:t,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(t){let e=ui(t.type),i=er(t.type);if(!!e){this.setPointersPositions(t);var r=!1;this._changedPointerPositions.forEach(o=>{var l=this.getIntersection(o);if(yt.justDragged=!1,st["_"+i+"ListenClick"]=!0,!(l&&l.isListening()))return;st.capturePointerEventsEnabled&&l.setPointerCapture(o.id),this[i+"ClickStartShape"]=l,l._fireAndBubble(e.pointerdown,{evt:t,pointerId:o.id}),r=!0;let h=t.type.indexOf("touch")>=0;l.preventDefault()&&t.cancelable&&h&&t.preventDefault()}),r||this._fire(e.pointerdown,{evt:t,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(t){let e=ui(t.type),i=er(t.type);if(!e)return;yt.isDragging&&yt.node.preventDefault()&&t.cancelable&&t.preventDefault(),this.setPointersPositions(t);var r=!yt.isDragging||st.hitOnDragEnabled;if(!r)return;var o={};let l=!1;var a=this._getTargetShape(i);this._changedPointerPositions.forEach(h=>{let f=oo(h.id)||this.getIntersection(h),s=h.id,c={evt:t,pointerId:s};var d=a!==f;if(d&&a&&(a._fireAndBubble(e.pointerout,Object.assign({},c),f),a._fireAndBubble(e.pointerleave,Object.assign({},c),f)),f){if(o[f._id])return;o[f._id]=!0}f&&f.isListening()?(l=!0,d&&(f._fireAndBubble(e.pointerover,Object.assign({},c),a),f._fireAndBubble(e.pointerenter,Object.assign({},c),a),this[i+"targetShape"]=f),f._fireAndBubble(e.pointermove,Object.assign({},c))):a&&(this._fire(e.pointerover,{evt:t,target:this,currentTarget:this,pointerId:s}),this[i+"targetShape"]=null)}),l||this._fire(e.pointermove,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(t){let e=ui(t.type),i=er(t.type);if(!e)return;this.setPointersPositions(t);let r=this[i+"ClickStartShape"],o=this[i+"ClickEndShape"];var l={};let a=!1;this._changedPointerPositions.forEach(h=>{let f=oo(h.id)||this.getIntersection(h);if(f){if(f.releaseCapture(h.id),l[f._id])return;l[f._id]=!0}let s=h.id,c={evt:t,pointerId:s},d=!1;st["_"+i+"InDblClickWindow"]?(d=!0,clearTimeout(this[i+"DblTimeout"])):yt.justDragged||(st["_"+i+"InDblClickWindow"]=!0,clearTimeout(this[i+"DblTimeout"])),this[i+"DblTimeout"]=setTimeout(function(){st["_"+i+"InDblClickWindow"]=!1},st.dblClickWindow),f&&f.isListening()?(a=!0,this[i+"ClickEndShape"]=f,f._fireAndBubble(e.pointerup,Object.assign({},c)),st["_"+i+"ListenClick"]&&r&&r===f&&(f._fireAndBubble(e.pointerclick,Object.assign({},c)),d&&o&&o===f&&f._fireAndBubble(e.pointerdblclick,Object.assign({},c)))):(this[i+"ClickEndShape"]=null,st["_"+i+"ListenClick"]&&this._fire(e.pointerclick,{evt:t,target:this,currentTarget:this,pointerId:s}),d&&this._fire(e.pointerdblclick,{evt:t,target:this,currentTarget:this,pointerId:s}))}),a||this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),st["_"+i+"ListenClick"]=!1,t.cancelable&&t.preventDefault()}_contextmenu(t){this.setPointersPositions(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(_a,{evt:t}):this._fire(_a,{evt:t,target:this,currentTarget:this})}_wheel(t){this.setPointersPositions(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(Ca,{evt:t}):this._fire(Ca,{evt:t,target:this,currentTarget:this})}_pointercancel(t){this.setPointersPositions(t);let e=oo(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble(hi,so(t)),Vn(t.pointerId)}_lostpointercapture(t){Vn(t.pointerId)}setPointersPositions(t){var e=this._getContentPosition(),i=null,r=null;t=t||window.event,t.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(t.touches,o=>{this._pointerPositions.push({id:o.identifier,x:(o.clientX-e.left)/e.scaleX,y:(o.clientY-e.top)/e.scaleY})}),Array.prototype.forEach.call(t.changedTouches||t.touches,o=>{this._changedPointerPositions.push({id:o.identifier,x:(o.clientX-e.left)/e.scaleX,y:(o.clientY-e.top)/e.scaleY})})):(i=(t.clientX-e.left)/e.scaleX,r=(t.clientY-e.top)/e.scaleY,this.pointerPos={x:i,y:r},this._pointerPositions=[{x:i,y:r,id:W._getFirstPointerId(t)}],this._changedPointerPositions=[{x:i,y:r,id:W._getFirstPointerId(t)}])}_setPointerPosition(t){W.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(t)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Ze({width:this.width(),height:this.height()}),this.bufferHitCanvas=new jn({pixelRatio:1,width:this.width(),height:this.height()}),!!st.isBrowser){var t=this.container();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}}cache(){return W.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(t){t.batchDraw()}),this}};di.prototype.nodeType=fg;se(di);q.addGetterSetter(di,"container");var wg="#",_g="beforeDraw",Cg="draw",eh=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Sg=eh.length,Je=class extends Zt{constructor(t){super(t);this.canvas=new Ze,this.hitCanvas=new jn({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){ot.prototype.moveToTop.call(this);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){var t=ot.prototype.moveUp.call(this);if(!t)return!1;var e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(ot.prototype.moveDown.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(ot.prototype.moveToBottom.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var t=this.getNativeCanvasElement();return ot.prototype.remove.call(this),t&&t.parentNode&&W._isInDocument(t)&&t.parentNode.removeChild(t),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&W.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return t=t||{},t.width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=t.x!==void 0?t.x:this.x(),t.y=t.y!==void 0?t.y:this.y(),ot.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){W.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){W.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,W.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var e=1,i=!1;;){for(let r=0;r<Sg;r++){let o=eh[r],l=this._getIntersection({x:t.x+o.x*e,y:t.y+o.y*e}),a=l.shape;if(a)return a;if(i=!!l.antialiased,!l.antialiased)break}if(i)e+=1;else return null}}_getIntersection(t){let e=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,r=i[3];if(r===255){let o=W._rgbToHex(i[0],i[1],i[2]),l=Un[wg+o];return l?{shape:l}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(t,e){var i=this.getLayer(),r=t||i&&i.getCanvas();return this._fire(_g,{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),Zt.prototype.drawScene.call(this,r,e),this._fire(Cg,{node:this}),this}drawHit(t,e){var i=this.getLayer(),r=t||i&&i.hitCanvas;return i&&i.clearBeforeDraw()&&i.getHitCanvas().getContext().clear(),Zt.prototype.drawHit.call(this,r,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){W.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return W.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,e=!!this.hitCanvas._canvas.parentNode;e?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}};Je.prototype.nodeType="Layer";se(Je);q.addGetterSetter(Je,"imageSmoothingEnabled",!0);q.addGetterSetter(Je,"clearBeforeDraw",!0);q.addGetterSetter(Je,"hitGraphEnabled",!0,Ce());var ir=class extends Je{constructor(t){super(t);this.listening(!1),W.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};ir.prototype.nodeType="FastLayer";se(ir);var rr=class extends Zt{_validateAdd(t){var e=t.getType();e!=="Group"&&e!=="Shape"&&W.throw("You may only add groups and shapes to groups.")}};rr.prototype.nodeType="Group";se(rr);var Sa=function(){return Wn.performance&&Wn.performance.now?function(){return Wn.performance.now()}:function(){return new Date().getTime()}}(),ae=class{constructor(t,e){this.id=ae.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Sa(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){var e=[];return t?t.length>0?e=t:e=[t]:e=[],this.layers=e,this}getLayers(){return this.layers}addLayer(t){var e=this.layers,i=e.length,r;for(r=0;r<i;r++)if(e[r]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){var t=ae,e=t.animations,i=e.length,r;for(r=0;r<i;r++)if(e[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=Sa(),ae._addAnimation(this),this}stop(){return ae._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){var e=t.id,i=this.animations,r=i.length,o;for(o=0;o<r;o++)if(i[o].id===e){this.animations.splice(o,1);break}}static _runFrames(){var t={},e=this.animations,i,r,o,l,a,h,f,s,c;for(l=0;l<e.length;l++)if(i=e[l],r=i.layers,o=i.func,i._updateFrameObject(Sa()),h=r.length,o?c=o.call(i,i.frame)!==!1:c=!0,!!c)for(a=0;a<h;a++)f=r[a],f._id!==void 0&&(t[f._id]=f);for(s in t)!t.hasOwnProperty(s)||t[s].batchDraw()}static _animationLoop(){var t=ae;t.animations.length?(t._runFrames(),W.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,W.requestAnimFrame(this._animationLoop))}};ae.animations=[];ae.animIdCounter=0;ae.animRunning=!1;var Ag={node:1,duration:1,easing:1,onFinish:1,yoyo:1},Eg=1,nh=2,ih=3,Tg=0,rh=["fill","stroke","shadowColor"],oh=class{constructor(t,e,i,r,o,l,a){this.prop=t,this.propFunc=e,this.begin=r,this._pos=r,this.duration=l,this._change=0,this.prevPos=0,this.yoyo=a,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=i,this._change=o-this.begin,this.pause()}fire(t){var e=this[t];e&&e()}setTime(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){return t===void 0&&(t=this._time),this.func(t,this.begin,this._change,this.duration)}play(){this.state=nh,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=ih,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var t=this.getTimer()-this._startTime;this.state===nh?this.setTime(t):this.state===ih&&this.setTime(this.duration-t)}pause(){this.state=Eg,this.fire("onPause")}getTimer(){return new Date().getTime()}},Rt=class{constructor(t){var e=this,i=t.node,r=i._id,o,l=t.easing||fi.Linear,a=!!t.yoyo,h;typeof t.duration>"u"?o=.3:t.duration===0?o=.001:o=t.duration,this.node=i,this._id=Tg++;var f=i.getLayer()||(i instanceof st.Stage?i.getLayers():null);f||W.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new ae(function(){e.tween.onEnterFrame()},f),this.tween=new oh(h,function(s){e._tweenFunc(s)},l,0,1,o*1e3,a),this._addListeners(),Rt.attrs[r]||(Rt.attrs[r]={}),Rt.attrs[r][this._id]||(Rt.attrs[r][this._id]={}),Rt.tweens[r]||(Rt.tweens[r]={});for(h in t)Ag[h]===void 0&&this._addAttr(h,t[h]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,e){var i=this.node,r=i._id,o,l,a,h,f,s,c,d;if(a=Rt.tweens[r][t],a&&delete Rt.attrs[r][a][t],o=i.getAttr(t),W._isArray(e))if(l=[],f=Math.max(e.length,o.length),t==="points"&&e.length!==o.length&&(e.length>o.length?(c=o,o=W._prepareArrayForTween(o,e,i.closed())):(s=e,e=W._prepareArrayForTween(e,o,i.closed()))),t.indexOf("fill")===0)for(h=0;h<f;h++)if(h%2===0)l.push(e[h]-o[h]);else{var u=W.colorToRGBA(o[h]);d=W.colorToRGBA(e[h]),o[h]=u,l.push({r:d.r-u.r,g:d.g-u.g,b:d.b-u.b,a:d.a-u.a})}else for(h=0;h<f;h++)l.push(e[h]-o[h]);else rh.indexOf(t)!==-1?(o=W.colorToRGBA(o),d=W.colorToRGBA(e),l={r:d.r-o.r,g:d.g-o.g,b:d.b-o.b,a:d.a-o.a}):l=e-o;Rt.attrs[r][this._id][t]={start:o,diff:l,end:e,trueEnd:s,trueStart:c},Rt.tweens[r][t]=this._id}_tweenFunc(t){var e=this.node,i=Rt.attrs[e._id][this._id],r,o,l,a,h,f,s,c;for(r in i){if(o=i[r],l=o.start,a=o.diff,c=o.end,W._isArray(l))if(h=[],s=Math.max(l.length,c.length),r.indexOf("fill")===0)for(f=0;f<s;f++)f%2===0?h.push((l[f]||0)+a[f]*t):h.push("rgba("+Math.round(l[f].r+a[f].r*t)+","+Math.round(l[f].g+a[f].g*t)+","+Math.round(l[f].b+a[f].b*t)+","+(l[f].a+a[f].a*t)+")");else for(f=0;f<s;f++)h.push((l[f]||0)+a[f]*t);else rh.indexOf(r)!==-1?h="rgba("+Math.round(l.r+a.r*t)+","+Math.round(l.g+a.g*t)+","+Math.round(l.b+a.b*t)+","+(l.a+a.a*t)+")":h=l+a*t;e.setAttr(r,h)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var t=this.node,e=Rt.attrs[t._id][this._id];e.points&&e.points.trueEnd&&t.setAttr("points",e.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var t=this.node,e=Rt.attrs[t._id][this._id];e.points&&e.points.trueStart&&t.points(e.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(t*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var t=this.node._id,e=this._id,i=Rt.tweens[t],r;this.pause();for(r in i)delete Rt.tweens[t][r];delete Rt.attrs[t][e]}};Rt.attrs={};Rt.tweens={};ot.prototype.to=function(n){var t=n.onFinish;n.node=this,n.onFinish=function(){this.destroy(),t&&t()};var e=new Rt(n);e.play()};var fi={BackEaseIn(n,t,e,i){var r=1.70158;return e*(n/=i)*n*((r+1)*n-r)+t},BackEaseOut(n,t,e,i){var r=1.70158;return e*((n=n/i-1)*n*((r+1)*n+r)+1)+t},BackEaseInOut(n,t,e,i){var r=1.70158;return(n/=i/2)<1?e/2*(n*n*(((r*=1.525)+1)*n-r))+t:e/2*((n-=2)*n*(((r*=1.525)+1)*n+r)+2)+t},ElasticEaseIn(n,t,e,i,r,o){var l=0;return n===0?t:(n/=i)===1?t+e:(o||(o=i*.3),!r||r<Math.abs(e)?(r=e,l=o/4):l=o/(2*Math.PI)*Math.asin(e/r),-(r*Math.pow(2,10*(n-=1))*Math.sin((n*i-l)*(2*Math.PI)/o))+t)},ElasticEaseOut(n,t,e,i,r,o){var l=0;return n===0?t:(n/=i)===1?t+e:(o||(o=i*.3),!r||r<Math.abs(e)?(r=e,l=o/4):l=o/(2*Math.PI)*Math.asin(e/r),r*Math.pow(2,-10*n)*Math.sin((n*i-l)*(2*Math.PI)/o)+e+t)},ElasticEaseInOut(n,t,e,i,r,o){var l=0;return n===0?t:(n/=i/2)===2?t+e:(o||(o=i*(.3*1.5)),!r||r<Math.abs(e)?(r=e,l=o/4):l=o/(2*Math.PI)*Math.asin(e/r),n<1?-.5*(r*Math.pow(2,10*(n-=1))*Math.sin((n*i-l)*(2*Math.PI)/o))+t:r*Math.pow(2,-10*(n-=1))*Math.sin((n*i-l)*(2*Math.PI)/o)*.5+e+t)},BounceEaseOut(n,t,e,i){return(n/=i)<1/2.75?e*(7.5625*n*n)+t:n<2/2.75?e*(7.5625*(n-=1.5/2.75)*n+.75)+t:n<2.5/2.75?e*(7.5625*(n-=2.25/2.75)*n+.9375)+t:e*(7.5625*(n-=2.625/2.75)*n+.984375)+t},BounceEaseIn(n,t,e,i){return e-fi.BounceEaseOut(i-n,0,e,i)+t},BounceEaseInOut(n,t,e,i){return n<i/2?fi.BounceEaseIn(n*2,0,e,i)*.5+t:fi.BounceEaseOut(n*2-i,0,e,i)*.5+e*.5+t},EaseIn(n,t,e,i){return e*(n/=i)*n+t},EaseOut(n,t,e,i){return-e*(n/=i)*(n-2)+t},EaseInOut(n,t,e,i){return(n/=i/2)<1?e/2*n*n+t:-e/2*(--n*(n-2)-1)+t},StrongEaseIn(n,t,e,i){return e*(n/=i)*n*n*n*n+t},StrongEaseOut(n,t,e,i){return e*((n=n/i-1)*n*n*n*n+1)+t},StrongEaseInOut(n,t,e,i){return(n/=i/2)<1?e/2*n*n*n*n*n+t:e/2*((n-=2)*n*n*n*n+2)+t},Linear(n,t,e,i){return e*n/i+t}};var Aa=W._assign(st,{Util:W,Transform:De,Node:ot,Container:Zt,Stage:di,stages:nr,Layer:Je,FastLayer:ir,Group:rr,DD:yt,Shape:J,shapes:Un,Animation:ae,Tween:Rt,Easings:fi,Context:li,Canvas:ci});var Jt=Aa;function Gn(n,t){this._waveformData=n,this._channelIndex=t}Gn.prototype.min_sample=function(n){var t=(n*this._waveformData.channels+this._channelIndex)*2;return this._waveformData._at(t)};Gn.prototype.max_sample=function(n){var t=(n*this._waveformData.channels+this._channelIndex)*2+1;return this._waveformData._at(t)};Gn.prototype.set_min_sample=function(n,t){var e=(n*this._waveformData.channels+this._channelIndex)*2;return this._waveformData._set_at(e,t)};Gn.prototype.set_max_sample=function(n,t){var e=(n*this._waveformData.channels+this._channelIndex)*2+1;return this._waveformData._set_at(e,t)};Gn.prototype.min_array=function(){return this._waveformData._offsetValues(0,this._waveformData.length,this._channelIndex*2)};Gn.prototype.max_array=function(){return this._waveformData._offsetValues(0,this._waveformData.length,this._channelIndex*2+1)};var pi=127,yo=-128;function xg(n,t){var e=Math.floor(n/t),i=n-e*t;return i>0&&e++,e}function kg(n){var t=n.scale,e=n.amplitude_scale,i=n.split_channels,r=n.length,o=n.sample_rate,l=n.channels.map(function(_){return new Float32Array(_)}),a=i?l.length:1,h=a===1?1:2,f=h===1?20:24,s=xg(r,t),c=f+s*2*a,d=new ArrayBuffer(c),u=new DataView(d),p=0,m=f,y,g,v=new Array(a),b=new Array(a);for(y=0;y<a;y++)v[y]=1/0,b[y]=-1/0;for(u.setInt32(0,h,!0),u.setUint32(4,1,!0),u.setInt32(8,o,!0),u.setInt32(12,t,!0),u.setInt32(16,s,!0),h===2&&u.setInt32(20,a,!0),g=0;g<r;g++){var w=0;if(a===1){for(y=0;y<l.length;++y)w+=l[y][g];w=Math.floor(pi*w*e/l.length),w<v[0]&&(v[0]=w,v[0]<yo&&(v[0]=yo)),w>b[0]&&(b[0]=w,b[0]>pi&&(b[0]=pi))}else for(y=0;y<a;++y)w=Math.floor(pi*l[y][g]*e),w<v[y]&&(v[y]=w,v[y]<yo&&(v[y]=yo)),w>b[y]&&(b[y]=w,b[y]>pi&&(b[y]=pi));if(++p===t){for(y=0;y<a;y++)u.setInt8(m++,v[y]),u.setInt8(m++,b[y]),v[y]=1/0,b[y]=-1/0;p=0}}if(p>0)for(y=0;y<a;y++)u.setInt8(m++,v[y]),u.setInt8(m++,b[y]);return d}function or(n){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?or=function(t){return typeof t}:or=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},or(n)}function Dg(n){return n&&or(n)==="object"&&"sample_rate"in n&&"samples_per_pixel"in n&&"bits"in n&&"length"in n&&"data"in n}function Lg(n){var t=n&&or(n)==="object"&&"byteLength"in n;if(t){var e=new DataView(n),i=e.getInt32(0,!0);if(i!==1&&i!==2)throw new TypeError("WaveformData.create(): This waveform data version not supported")}return t}function Pg(n){var t=n.data,e=n.channels||1,i=24,r=n.bits===8?1:2,o=n.length*2*e;if(t.length!==o)throw new Error("WaveformData.create(): Length mismatch in JSON waveform data");var l=i+t.length*r,a=new ArrayBuffer(l),h=new DataView(a);h.setInt32(0,2,!0),h.setUint32(4,n.bits===8,!0),h.setInt32(8,n.sample_rate,!0),h.setInt32(12,n.samples_per_pixel,!0),h.setInt32(16,n.length,!0),h.setInt32(20,e,!0);var f=i,s;if(n.bits===8)for(s=0;s<t.length;s++)h.setInt8(f++,t[s],!0);else for(s=0;s<t.length;s++)h.setInt16(f,t[s],!0),f+=2;return a}function Og(n,t){var e=atob(n);if(t){for(var i=new Uint8Array(e.length),r=0,o=e.length;r<o;++r)i[r]=e.charCodeAt(r);return String.fromCharCode.apply(null,new Uint16Array(i.buffer))}return e}function Mg(n,t,e){var i=t===void 0?null:t,r=e===void 0?!1:e,o=Og(n,r),l=o.indexOf(`
`,10)+1,a=o.substring(l)+(i?"((a,h,f)=>bi[a]&&f[h-1]!=="\\"?bi[a](i,l,n):a!=="\\"?a:"").join("")},No=({config:n=An,l10n:t=Mo})=>(e,i,r,o)=>{if(e!==0&&!e)return;let l=o||t,a,h=e;if(e instanceof Date)a=new Date(e.getTime());else if(typeof e!="string"&&e.toFixed!==void 0)a=new Date(e);else if(typeof e=="string"){let f=i||(n||An).dateFormat,s=String(e).trim();if(s==="today")a=new Date,r=!0;else if(/Z$/.test(s)||/GMT$/.test(s))a=new Date(e);else if(n&&n.parseDate)a=n.parseDate(e,f);else{a=!n||!n.noCalendar?new Date(new Date().getFullYear(),0,1,0,0,0,0):new Date(new Date().setHours(0,0,0,0));let c,d=[];for(let u=0,p=0,m="";u<f.length;u++){let y=f[u],g=y==="\\",v=f[u-1]==="\\"||g;if(pr[y]&&!v){m+=pr[y];let b=new RegExp(m).exec(e);b&&(c=!0)&&d[y!=="Y"?"push":"unshift"]({fn:Ih[y],val:b[++p]})}else g||(m+=".");d.forEach(({fn:b,val:w})=>a=b(a,w,l)||a)}a=c?a:void 0}}if(!(a instanceof Date&&!isNaN(a.getTime()))){n.errorHandler(new Error(`Invalid date provided: ${h}`));return}return r===!0&&a.setHours(0,0,0,0),a};function _e(n,t,e=!0){return e!==!1?new Date(n.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):n.getTime()-t.getTime()}var Rh=(n,t,e)=>n>Math.min(t,e)&&n<Math.max(t,e),Nh={DAY:864e5};function Fo(n){let t=n.defaultHour,e=n.defaultMinute,i=n.defaultSeconds;if(n.minDate!==void 0){let r=n.minDate.getHours(),o=n.minDate.getMinutes(),l=n.minDate.getSeconds();t<r&&(t=r),t===r&&e<o&&(e=o),t===r&&e===o&&i<l&&(i=n.minDate.getSeconds())}if(n.maxDate!==void 0){let r=n.maxDate.getHours(),o=n.maxDate.getMinutes();t=Math.min(t,r),t===r&&(e=Math.min(o,e)),t===r&&e===o&&(i=n.maxDate.getSeconds())}return{hours:t,minutes:e,seconds:i}}typeof Object.assign!="function"&&(Object.assign=function(n,...t){if(!n)throw TypeError("Cannot convert undefined or null to object");for(let e of t)e&&Object.keys(e).forEach(i=>n[i]=e[i]);return n});var fv=300;function pv(n,t){let e={config:Object.assign(Object.assign({},An),zt.defaultConfig),l10n:Io};e.parseDate=No({config:e.config,l10n:e.l10n}),e._handlers=[],e.pluginElements=[],e.loadedPlugins=[],e._bind=p,e._setHoursFromDate=c,e._positionCalendar=Ft,e.changeMonth=Z,e.changeYear=bt,e.clear=K,e.close=tt,e._createElement=_t,e.destroy=nt,e.isEnabled=Ot,e.jumpToDate=g,e.open=R,e.redraw=kt,e.set=$n,e.setDate=Zn,e.toggle=Xo;function i(){e.utils={getDaysInMonth(x=e.currentMonth,D=e.currentYear){return x===1&&(D%4===0&&D%100!==0||D%400===0)?29:e.l10n.daysInMonth[x]}}}function r(){e.element=e.input=n,e.isOpen=!1,B(),Et(),Yo(),qo(),i(),e.isMobile||w(),y(),(e.selectedDates.length||e.config.noCalendar)&&(e.config.enableTime&&c(e.config.noCalendar?e.latestSelectedDateObj:void 0),Pt(!1)),l();let x=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!e.isMobile&&x&&Ft(),Dt("onReady")}function o(x){return x.bind(e)}function l(){let x=e.config;x.weekNumbers===!1&&x.showMonths===1||x.noCalendar!==!0&&window.requestAnimationFrame(function(){if(e.calendarContainer!==void 0&&(e.calendarContainer.style.visibility="hidden",e.calendarContainer.style.display="block"),e.daysContainer!==void 0){let D=(e.days.offsetWidth+1)*x.showMonths;e.daysContainer.style.width=D+"px",e.calendarContainer.style.width=D+(e.weekWrapper!==void 0?e.weekWrapper.offsetWidth:0)+"px",e.calendarContainer.style.removeProperty("visibility"),e.calendarContainer.style.removeProperty("display")}})}function a(x){if(e.selectedDates.length===0){let H=e.config.minDate===void 0||_e(new Date,e.config.minDate)>=0?new Date:new Date(e.config.minDate.getTime()),U=Fo(e.config);H.setHours(U.hours,U.minutes,U.seconds,H.getMilliseconds()),e.selectedDates=[H],e.latestSelectedDateObj=H}x!==void 0&&x.type!=="blur"&&cn(x);let D=e._input.value;s(),Pt(),e._input.value!==D&&e._debouncedChange()}function h(x,D){return x%12+12*be(D===e.l10n.amPM[1])}function f(x){switch(x%24){case 0:case 12:return 12;default:return x%12}}function s(){if(e.hourElement===void 0||e.minuteElement===void 0)return;let x=(parseInt(e.hourElement.value.slice(-2),10)||0)%24,D=(parseInt(e.minuteElement.value,10)||0)%60,H=e.secondElement!==void 0?(parseInt(e.secondElement.value,10)||0)%60:0;e.amPM!==void 0&&(x=h(x,e.amPM.textContent));let U=e.config.minTime!==void 0||e.config.minDate&&e.minDateHasTime&&e.latestSelectedDateObj&&_e(e.latestSelectedDateObj,e.config.minDate,!0)===0;if(e.config.maxTime!==void 0||e.config.maxDate&&e.maxDateHasTime&&e.latestSelectedDateObj&&_e(e.latestSelectedDateObj,e.config.maxDate,!0)===0){let X=e.config.maxTime!==void 0?e.config.maxTime:e.config.maxDate;x=Math.min(x,X.getHours()),x===X.getHours()&&(D=Math.min(D,X.getMinutes())),D===X.getMinutes()&&(H=Math.min(H,X.getSeconds()))}if(U){let X=e.config.minTime!==void 0?e.config.minTime:e.config.minDate;x=Math.max(x,X.getHours()),x===X.getHours()&&D<X.getMinutes()&&(D=X.getMinutes()),D===X.getMinutes()&&(H=Math.max(H,X.getSeconds()))}d(x,D,H)}function c(x){let D=x||e.latestSelectedDateObj;D&&d(D.getHours(),D.getMinutes(),D.getSeconds())}function d(x,D,H){e.latestSelectedDateObj!==void 0&&e.latestSelectedDateObj.setHours(x%24,D,H||0,0),!(!e.hourElement||!e.minuteElement||e.isMobile)&&(e.hourElement.value=ue(e.config.time_24hr?x:(12+x)%12+12*be(x%12===0)),e.minuteElement.value=ue(D),e.amPM!==void 0&&(e.amPM.textContent=e.l10n.amPM[be(x>=12)]),e.secondElement!==void 0&&(e.secondElement.value=ue(H)))}function u(x){let D=we(x),H=parseInt(D.value)+(x.delta||0);(H/1e3>1||x.key==="Enter"&&!/[^\d]/.test(H.toString()))&&bt(H)}function p(x,D,H,U){if(D instanceof Array)return D.forEach(Q=>p(x,Q,H,U));if(x instanceof Array)return x.forEach(Q=>p(Q,D,H,U));x.addEventListener(D,H,U),e._handlers.push({remove:()=>x.removeEventListener(D,H)})}function m(){Dt("onChange")}function y(){if(e.config.wrap&&["open","close","toggle","clear"].forEach(D=>{Array.prototype.forEach.call(e.element.querySelectorAll(`[data-${D}]`),H=>p(H,"click",e[D]))}),e.isMobile){Ko();return}let x=Ba(V,50);if(e._debouncedChange=Ba(m,fv),e.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&p(e.daysContainer,"mouseover",D=>{e.config.mode==="range"&&z(we(D))}),p(window.document.body,"keydown",pt),!e.config.inline&&!e.config.static&&p(window,"resize",x),window.ontouchstart!==void 0?p(window.document,"touchstart",ft):p(window.document,"mousedown",ft),p(window.document,"focus",ft,{capture:!0}),e.config.clickOpens===!0&&(p(e._input,"focus",e.open),p(e._input,"click",e.open)),e.daysContainer!==void 0&&(p(e.monthNav,"click",ve),p(e.monthNav,["keyup","increment"],u),p(e.daysContainer,"click",Ve)),e.timeContainer!==void 0&&e.minuteElement!==void 0&&e.hourElement!==void 0){let D=H=>we(H).select();p(e.timeContainer,["increment"],a),p(e.timeContainer,"blur",a,{capture:!0}),p(e.timeContainer,"click",v),p([e.hourElement,e.minuteElement],["focus","click"],D),e.secondElement!==void 0&&p(e.secondElement,"focus",()=>e.secondElement&&e.secondElement.select()),e.amPM!==void 0&&p(e.amPM,"click",H=>{a(H),m()})}e.config.allowInput&&p(e._input,"blur",Ht)}function g(x,D){let H=x!==void 0?e.parseDate(x):e.latestSelectedDateObj||(e.config.minDate&&e.config.minDate>e.now?e.config.minDate:e.config.maxDate&&e.config.maxDate<e.now?e.config.maxDate:e.now),U=e.currentYear,Q=e.currentMonth;try{H!==void 0&&(e.currentYear=H.getFullYear(),e.currentMonth=H.getMonth())}catch(X){X.message="Invalid date supplied: "+H,e.config.errorHandler(X)}D&&e.currentYear!==U&&(Dt("onYearChange"),L()),D&&(e.currentYear!==U||e.currentMonth!==Q)&&Dt("onMonthChange"),e.redraw()}function v(x){let D=we(x);~D.className.indexOf("arrow")&&b(x,D.classList.contains("arrowUp")?1:-1)}function b(x,D,H){let U=x&&we(x),Q=H||U&&U.parentNode&&U.parentNode.firstChild,X=G("increment");X.delta=D,Q&&Q.dispatchEvent(X)}function w(){let x=window.document.createDocumentFragment();if(e.calendarContainer=_t("div","flatpickr-calendar"),e.calendarContainer.tabIndex=-1,!e.config.noCalendar){if(x.appendChild(E()),e.innerContainer=_t("div","flatpickr-innerContainer"),e.config.weekNumbers){let{weekWrapper:H,weekNumbers:U}=$();e.innerContainer.appendChild(H),e.weekNumbers=U,e.weekWrapper=H}e.rContainer=_t("div","flatpickr-rContainer"),e.rContainer.appendChild(j()),e.daysContainer||(e.daysContainer=_t("div","flatpickr-days"),e.daysContainer.tabIndex=-1),P(),e.rContainer.appendChild(e.daysContainer),e.innerContainer.appendChild(e.rContainer),x.appendChild(e.innerContainer)}e.config.enableTime&&x.appendChild(O()),he(e.calendarContainer,"rangeMode",e.config.mode==="range"),he(e.calendarContainer,"animate",e.config.animate===!0),he(e.calendarContainer,"multiMonth",e.config.showMonths>1),e.calendarContainer.appendChild(x);let D=e.config.appendTo!==void 0&&e.config.appendTo.nodeType!==void 0;if((e.config.inline||e.config.static)&&(e.calendarContainer.classList.add(e.config.inline?"inline":"static"),e.config.inline&&(!D&&e.element.parentNode?e.element.parentNode.insertBefore(e.calendarContainer,e._input.nextSibling):e.config.appendTo!==void 0&&e.config.appendTo.appendChild(e.calendarContainer)),e.config.static)){let H=_t("div","flatpickr-wrapper");e.element.parentNode&&e.element.parentNode.insertBefore(H,e.element),H.appendChild(e.element),e.altInput&&H.appendChild(e.altInput),H.appendChild(e.calendarContainer)}!e.config.static&&!e.config.inline&&(e.config.appendTo!==void 0?e.config.appendTo:window.document.body).appendChild(e.calendarContainer)}function _(x,D,H,U){let Q=Ot(D,!0),X=_t("span","flatpickr-day "+x,D.getDate().toString());return X.dateObj=D,X.$i=U,X.setAttribute("aria-label",e.formatDate(D,e.config.ariaDateFormat)),x.indexOf("hidden")===-1&&_e(D,e.now)===0&&(e.todayDateElem=X,X.classList.add("today"),X.setAttribute("aria-current","date")),Q?(X.tabIndex=-1,it(D)&&(X.classList.add("selected"),e.selectedDateElem=X,e.config.mode==="range"&&(he(X,"startRange",e.selectedDates[0]&&_e(D,e.selectedDates[0],!0)===0),he(X,"endRange",e.selectedDates[1]&&_e(D,e.selectedDates[1],!0)===0),x==="nextMonthDay"&&X.classList.add("inRange")))):X.classList.add("flatpickr-disabled"),e.config.mode==="range"&&ct(D)&&!it(D)&&X.classList.add("inRange"),e.weekNumbers&&e.config.showMonths===1&&x!=="prevMonthDay"&&H%7===1&&e.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+e.config.getWeek(D)+"</span>"),Dt("onDayCreate",X),X}function C(x){x.focus(),e.config.mode==="range"&&z(x)}function S(x){let D=x>0?0:e.config.showMonths-1,H=x>0?e.config.showMonths:-1;for(let U=D;U!=H;U+=x){let Q=e.daysContainer.children[U],X=x>0?0:Q.children.length-1,at=x>0?Q.children.length:-1;for(let rt=X;rt!=at;rt+=x){let mt=Q.children[rt];if(mt.className.indexOf("hidden")===-1&&Ot(mt.dateObj))return mt}}}function T(x,D){let H=x.className.indexOf("Month")===-1?x.dateObj.getMonth():e.currentMonth,U=D>0?e.config.showMonths:-1,Q=D>0?1:-1;for(let X=H-e.currentMonth;X!=U;X+=Q){let at=e.daysContainer.children[X],rt=H-e.currentMonth===X?x.$i+D:D<0?at.children.length-1:0,mt=at.children.length;for(let vt=rt;vt>=0&&vt<mt&&vt!=(D>0?mt:-1);vt+=Q){let Lt=at.children[vt];if(Lt.className.indexOf("hidden")===-1&&Ot(Lt.dateObj)&&Math.abs(x.$i-vt)>=Math.abs(D))return C(Lt)}}e.changeMonth(Q),I(S(Q),0)}function I(x,D){let H=Mt(document.activeElement||document.body),U=x!==void 0?x:H?document.activeElement:e.selectedDateElem!==void 0&&Mt(e.selectedDateElem)?e.selectedDateElem:e.todayDateElem!==void 0&&Mt(e.todayDateElem)?e.todayDateElem:S(D>0?1:-1);U===void 0?e._input.focus():H?T(U,D):C(U)}function F(x,D){let H=(new Date(x,D,1).getDay()-e.l10n.firstDayOfWeek+7)%7,U=e.utils.getDaysInMonth((D-1+12)%12,x),Q=e.utils.getDaysInMonth(D,x),X=window.document.createDocumentFragment(),at=e.config.showMonths>1,rt=at?"prevMonthDay hidden":"prevMonthDay",mt=at?"nextMonthDay hidden":"nextMonthDay",vt=U+1-H,Lt=0;for(;vt<=U;vt++,Lt++)X.appendChild(_(rt,new Date(x,D-1,vt),vt,Lt));for(vt=1;vt<=Q;vt++,Lt++)X.appendChild(_("",new Date(x,D,vt),vt,Lt));for(let ie=Q+1;ie<=42-H&&(e.config.showMonths===1||Lt%7!==0);ie++,Lt++)X.appendChild(_(mt,new Date(x,D+1,ie%Q),ie,Lt));let Te=_t("div","dayContainer");return Te.appendChild(X),Te}function P(){if(e.daysContainer===void 0)return;hr(e.daysContainer),e.weekNumbers&&hr(e.weekNumbers);let x=document.createDocumentFragment();for(let D=0;D<e.config.showMonths;D++){let H=new Date(e.currentYear,e.currentMonth,1);H.setMonth(e.currentMonth+D),x.appendChild(F(H.getFullYear(),H.getMonth()))}e.daysContainer.appendChild(x),e.days=e.daysContainer.firstChild,e.config.mode==="range"&&e.selectedDates.length===1&&z()}function L(){if(e.config.showMonths>1||e.config.monthSelectorType!=="dropdown")return;let x=function(D){return e.config.minDate!==void 0&&e.currentYear===e.config.minDate.getFullYear()&&D<e.config.minDate.getMonth()?!1:!(e.config.maxDate!==void 0&&e.currentYear===e.config.maxDate.getFullYear()&&D>e.config.maxDate.getMonth())};e.monthsDropdownContainer.tabIndex=-1,e.monthsDropdownContainer.innerHTML="";for(let D=0;D<12;D++){if(!x(D))continue;let H=_t("option","flatpickr-monthDropdown-month");H.value=new Date(e.currentYear,D).getMonth().toString(),H.textContent=fr(D,e.config.shorthandCurrentMonth,e.l10n),H.tabIndex=-1,e.currentMonth===D&&(H.selected=!0),e.monthsDropdownContainer.appendChild(H)}}function k(){let x=_t("div","flatpickr-month"),D=window.document.createDocumentFragment(),H;e.config.showMonths>1||e.config.monthSelectorType==="static"?H=_t("span","cur-month"):(e.monthsDropdownContainer=_t("select","flatpickr-monthDropdown-months"),e.monthsDropdownContainer.setAttribute("aria-label",e.l10n.monthAriaLabel),p(e.monthsDropdownContainer,"change",at=>{let rt=we(at),mt=parseInt(rt.value,10);e.changeMonth(mt-e.currentMonth),Dt("onMonthChange")}),L(),H=e.monthsDropdownContainer);let U=dr("cur-year",{tabindex:"-1"}),Q=U.getElementsByTagName("input")[0];Q.setAttribute("aria-label",e.l10n.yearAriaLabel),e.config.minDate&&Q.setAttribute("min",e.config.minDate.getFullYear().toString()),e.config.maxDate&&(Q.setAttribute("max",e.config.maxDate.getFullYear().toString()),Q.disabled=!!e.config.minDate&&e.config.minDate.getFullYear()===e.config.maxDate.getFullYear());let X=_t("div","flatpickr-current-month");return X.appendChild(H),X.appendChild(U),D.appendChild(X),x.appendChild(D),{container:x,yearElement:Q,monthElement:H}}function A(){hr(e.monthNav),e.monthNav.appendChild(e.prevMonthNav),e.config.showMonths&&(e.yearElements=[],e.monthElements=[]);for(let x=e.config.showMonths;x--;){let D=k();e.yearElements.push(D.yearElement),e.monthElements.push(D.monthElement),e.monthNav.appendChild(D.container)}e.monthNav.appendChild(e.nextMonthNav)}function E(){return e.monthNav=_t("div","flatpickr-months"),e.yearElements=[],e.monthElements=[],e.prevMonthNav=_t("span","flatpickr-prev-month"),e.prevMonthNav.innerHTML=e.config.prevArrow,e.nextMonthNav=_t("span","flatpickr-next-month"),e.nextMonthNav.innerHTML=e.config.nextArrow,A(),Object.defineProperty(e,"_hidePrevMonthArrow",{get:()=>e.__hidePrevMonthArrow,set(x){e.__hidePrevMonthArrow!==x&&(he(e.prevMonthNav,"flatpickr-disabled",x),e.__hidePrevMonthArrow=x)}}),Object.defineProperty(e,"_hideNextMonthArrow",{get:()=>e.__hideNextMonthArrow,set(x){e.__hideNextMonthArrow!==x&&(he(e.nextMonthNav,"flatpickr-disabled",x),e.__hideNextMonthArrow=x)}}),e.currentYearElement=e.yearElements[0],wt(),e.monthNav}function O(){e.calendarContainer.classList.add("hasTime"),e.config.noCalendar&&e.calendarContainer.classList.add("noCalendar");let x=Fo(e.config);e.timeContainer=_t("div","flatpickr-time"),e.timeContainer.tabIndex=-1;let D=_t("span","flatpickr-time-separator",":"),H=dr("flatpickr-hour",{"aria-label":e.l10n.hourAriaLabel});e.hourElement=H.getElementsByTagName("input")[0];let U=dr("flatpickr-minute",{"aria-label":e.l10n.minuteAriaLabel});if(e.minuteElement=U.getElementsByTagName("input")[0],e.hourElement.tabIndex=e.minuteElement.tabIndex=-1,e.hourElement.value=ue(e.latestSelectedDateObj?e.latestSelectedDateObj.getHours():e.config.time_24hr?x.hours:f(x.hours)),e.minuteElement.value=ue(e.latestSelectedDateObj?e.latestSelectedDateObj.getMinutes():x.minutes),e.hourElement.setAttribute("step",e.config.hourIncrement.toString()),e.minuteElement.setAttribute("step",e.config.minuteIncrement.toString()),e.hourElement.setAttribute("min",e.config.time_24hr?"0":"1"),e.hourElement.setAttribute("max",e.config.time_24hr?"23":"12"),e.hourElement.setAttribute("maxlength","2"),e.minuteElement.setAttribute("min","0"),e.minuteElement.setAttribute("max","59"),e.minuteElement.setAttribute("maxlength","2"),e.timeContainer.appendChild(H),e.timeContainer.appendChild(D),e.timeContainer.appendChild(U),e.config.time_24hr&&e.timeContainer.classList.add("time24hr"),e.config.enableSeconds){e.timeContainer.classList.add("hasSeconds");let Q=dr("flatpickr-second");e.secondElement=Q.getElementsByTagName("input")[0],e.secondElement.value=ue(e.latestSelectedDateObj?e.latestSelectedDateObj.getSeconds():x.seconds),e.secondElement.setAttribute("step",e.minuteElement.getAttribute("step")),e.secondElement.setAttribute("min","0"),e.secondElement.setAttribute("max","59"),e.secondElement.setAttribute("maxlength","2"),e.timeContainer.appendChild(_t("span","flatpickr-time-separator",":")),e.timeContainer.appendChild(Q)}return e.config.time_24hr||(e.amPM=_t("span","flatpickr-am-pm",e.l10n.amPM[be((e.latestSelectedDateObj?e.hourElement.value:e.config.defaultHour)>11)]),e.amPM.title=e.l10n.toggleTitle,e.amPM.tabIndex=-1,e.timeContainer.appendChild(e.amPM)),e.timeContainer}function j(){e.weekdayContainer?hr(e.weekdayContainer):e.weekdayContainer=_t("div","flatpickr-weekdays");for(let x=e.config.showMonths;x--;){let D=_t("div","flatpickr-weekdaycontainer");e.weekdayContainer.appendChild(D)}return Y(),e.weekdayContainer}function Y(){if(!e.weekdayContainer)return;let x=e.l10n.firstDayOfWeek,D=[...e.l10n.weekdays.shorthand];x>0&&x<D.length&&(D=[...D.splice(x,D.length),...D.splice(0,x)]);for(let H=e.config.showMonths;H--;)e.weekdayContainer.children[H].innerHTML=`
      <span class='flatpickr-weekday'>
        ${D.join("</span><span class='flatpickr-weekday'>")}
      </span>
      `}function $(){e.calendarContainer.classList.add("hasWeeks");let x=_t("div","flatpickr-weekwrapper");x.appendChild(_t("span","flatpickr-weekday",e.l10n.weekAbbreviation));let D=_t("div","flatpickr-weeks");return x.appendChild(D),{weekWrapper:x,weekNumbers:D}}function Z(x,D=!0){let H=D?x:x-e.currentMonth;H<0&&e._hidePrevMonthArrow===!0||H>0&&e._hideNextMonthArrow===!0||(e.currentMonth+=H,(e.currentMonth<0||e.currentMonth>11)&&(e.currentYear+=e.currentMonth>11?1:-1,e.currentMonth=(e.currentMonth+12)%12,Dt("onYearChange"),L()),P(),Dt("onMonthChange"),wt())}function K(x=!0,D=!0){if(e.input.value="",e.altInput!==void 0&&(e.altInput.value=""),e.mobileInput!==void 0&&(e.mobileInput.value=""),e.selectedDates=[],e.latestSelectedDateObj=void 0,D===!0&&(e.currentYear=e._initialDate.getFullYear(),e.currentMonth=e._initialDate.getMonth()),e.config.enableTime===!0){let{hours:H,minutes:U,seconds:Q}=Fo(e.config);d(H,U,Q)}e.redraw(),x&&Dt("onChange")}function tt(){e.isOpen=!1,e.isMobile||(e.calendarContainer!==void 0&&e.calendarContainer.classList.remove("open"),e._input!==void 0&&e._input.classList.remove("active")),Dt("onClose")}function nt(){e.config!==void 0&&Dt("onDestroy");for(let x=e._handlers.length;x--;)e._handlers[x].remove();if(e._handlers=[],e.mobileInput)e.mobileInput.parentNode&&e.mobileInput.parentNode.removeChild(e.mobileInput),e.mobileInput=void 0;else if(e.calendarContainer&&e.calendarContainer.parentNode)if(e.config.static&&e.calendarContainer.parentNode){let x=e.calendarContainer.parentNode;if(x.lastChild&&x.removeChild(x.lastChild),x.parentNode){for(;x.firstChild;)x.parentNode.insertBefore(x.firstChild,x);x.parentNode.removeChild(x)}}else e.calendarContainer.parentNode.removeChild(e.calendarContainer);e.altInput&&(e.input.type="text",e.altInput.parentNode&&e.altInput.parentNode.removeChild(e.altInput),delete e.altInput),e.input&&(e.input.type=e.input._type,e.input.classList.remove("flatpickr-input"),e.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(x=>{try{delete e[x]}catch{}})}function et(x){return e.config.appendTo&&e.config.appendTo.contains(x)?!0:e.calendarContainer.contains(x)}function ft(x){if(e.isOpen&&!e.config.inline){let D=we(x),H=et(D),U=D===e.input||D===e.altInput||e.element.contains(D)||x.path&&x.path.indexOf&&(~x.path.indexOf(e.input)||~x.path.indexOf(e.altInput)),Q=x.type==="blur"?U&&x.relatedTarget&&!et(x.relatedTarget):!U&&!H&&!et(x.relatedTarget),X=!e.config.ignoredFocusElements.some(at=>at.contains(D));Q&&X&&(e.timeContainer!==void 0&&e.minuteElement!==void 0&&e.hourElement!==void 0&&e.input.value!==""&&e.input.value!==void 0&&a(),e.close(),e.config&&e.config.mode==="range"&&e.selectedDates.length===1&&(e.clear(!1),e.redraw()))}}function bt(x){if(!x||e.config.minDate&&x<e.config.minDate.getFullYear()||e.config.maxDate&&x>e.config.maxDate.getFullYear())return;let D=x,H=e.currentYear!==D;e.currentYear=D||e.currentYear,e.config.maxDate&&e.currentYear===e.config.maxDate.getFullYear()?e.currentMonth=Math.min(e.config.maxDate.getMonth(),e.currentMonth):e.config.minDate&&e.currentYear===e.config.minDate.getFullYear()&&(e.currentMonth=Math.max(e.config.minDate.getMonth(),e.currentMonth)),H&&(e.redraw(),Dt("onYearChange"),L())}function Ot(x,D=!0){var H;let U=e.parseDate(x,void 0,D);if(e.config.minDate&&U&&_e(U,e.config.minDate,D!==void 0?D:!e.minDateHasTime)<0||e.config.maxDate&&U&&_e(U,e.config.maxDate,D!==void 0?D:!e.maxDateHasTime)>0)return!1;if(!e.config.enable&&e.config.disable.length===0)return!0;if(U===void 0)return!1;let Q=!!e.config.enable,X=(H=e.config.enable)!==null&&H!==void 0?H:e.config.disable;for(let at=0,rt;at<X.length;at++){if(rt=X[at],typeof rt=="function"&&rt(U))return Q;if(rt instanceof Date&&U!==void 0&&rt.getTime()===U.getTime())return Q;if(typeof rt=="string"){let mt=e.parseDate(rt,void 0,!0);return mt&&mt.getTime()===U.getTime()?Q:!Q}else if(typeof rt=="object"&&U!==void 0&&rt.from&&rt.to&&U.getTime()>=rt.from.getTime()&&U.getTime()<=rt.to.getTime())return Q}return!Q}function Mt(x){return e.daysContainer!==void 0?x.className.indexOf("hidden")===-1&&x.className.indexOf("flatpickr-disabled")===-1&&e.daysContainer.contains(x):!1}function Ht(x){x.target===e._input&&(e.selectedDates.length>0||e._input.value.length>0)&&!(x.relatedTarget&&et(x.relatedTarget))&&e.setDate(e._input.value,!0,x.target===e.altInput?e.config.altFormat:e.config.dateFormat)}function pt(x){let D=we(x),H=e.config.wrap?n.contains(D):D===e._input,U=e.config.allowInput,Q=e.isOpen&&(!U||!H),X=e.config.inline&&H&&!U;if(x.keyCode===13&&H){if(U)return e.setDate(e._input.value,!0,D===e.altInput?e.config.altFormat:e.config.dateFormat),D.blur();e.open()}else if(et(D)||Q||X){let at=!!e.timeContainer&&e.timeContainer.contains(D);switch(x.keyCode){case 13:at?(x.preventDefault(),a(),de()):Ve(x);break;case 27:x.preventDefault(),de();break;case 8:case 46:H&&!e.config.allowInput&&(x.preventDefault(),e.clear());break;case 37:case 39:if(!at&&!H){if(x.preventDefault(),e.daysContainer!==void 0&&(U===!1||document.activeElement&&Mt(document.activeElement))){let mt=x.keyCode===39?1:-1;x.ctrlKey?(x.stopPropagation(),Z(mt),I(S(1),0)):I(void 0,mt)}}else e.hourElement&&e.hourElement.focus();break;case 38:case 40:x.preventDefault();let rt=x.keyCode===40?1:-1;e.daysContainer&&D.$i!==void 0||D===e.input||D===e.altInput?x.ctrlKey?(x.stopPropagation(),bt(e.currentYear-rt),I(S(1),0)):at||I(void 0,rt*7):D===e.currentYearElement?bt(e.currentYear-rt):e.config.enableTime&&(!at&&e.hourElement&&e.hourElement.focus(),a(x),e._debouncedChange());break;case 9:if(at){let mt=[e.hourElement,e.minuteElement,e.secondElement,e.amPM].concat(e.pluginElements).filter(Lt=>Lt),vt=mt.indexOf(D);if(vt!==-1){let Lt=mt[vt+(x.shiftKey?-1:1)];x.preventDefault(),(Lt||e._input).focus()}}else!e.config.noCalendar&&e.daysContainer&&e.daysContainer.contains(D)&&x.shiftKey&&(x.preventDefault(),e._input.focus());break;default:break}}if(e.amPM!==void 0&&D===e.amPM)switch(x.key){case e.l10n.amPM[0].charAt(0):case e.l10n.amPM[0].charAt(0).toLowerCase():e.amPM.textContent=e.l10n.amPM[0],s(),Pt();break;case e.l10n.amPM[1].charAt(0):case e.l10n.amPM[1].charAt(0).toLowerCase():e.amPM.textContent=e.l10n.amPM[1],s(),Pt();break}(H||et(D))&&Dt("onKeyDown",x)}function z(x){if(e.selectedDates.length!==1||x&&(!x.classList.contains("flatpickr-day")||x.classList.contains("flatpickr-disabled")))return;let D=x?x.dateObj.getTime():e.days.firstElementChild.dateObj.getTime(),H=e.parseDate(e.selectedDates[0],void 0,!0).getTime(),U=Math.min(D,e.selectedDates[0].getTime()),Q=Math.max(D,e.selectedDates[0].getTime()),X=!1,at=0,rt=0;for(let mt=U;mt<Q;mt+=Nh.DAY)Ot(new Date(mt),!0)||(X=X||mt>U&&mt<Q,mt<H&&(!at||mt>at)?at=mt:mt>H&&(!rt||mt<rt)&&(rt=mt));for(let mt=0;mt<e.config.showMonths;mt++){let vt=e.daysContainer.children[mt];for(let Lt=0,Te=vt.children.length;Lt<Te;Lt++){let ie=vt.children[Lt],Ge=ie.dateObj.getTime(),Ci=at>0&&Ge<at||rt>0&&Ge>rt;if(Ci){ie.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(Si=>{ie.classList.remove(Si)});continue}else if(X&&!Ci)continue;["startRange","inRange","endRange","notAllowed"].forEach(Si=>{ie.classList.remove(Si)}),x!==void 0&&(x.classList.add(D<=e.selectedDates[0].getTime()?"startRange":"endRange"),H<D&&Ge===H?ie.classList.add("startRange"):H>D&&Ge===H&&ie.classList.add("endRange"),Ge>=at&&(rt===0||Ge<=rt)&&Rh(Ge,H,D)&&ie.classList.add("inRange"))}}}function V(){e.isOpen&&!e.config.static&&!e.config.inline&&Ft()}function R(x,D=e._positionElement){if(e.isMobile===!0){if(x){x.preventDefault();let U=we(x);U&&U.blur()}e.mobileInput!==void 0&&(e.mobileInput.focus(),e.mobileInput.click()),Dt("onOpen");return}else if(e._input.disabled||e.config.inline)return;let H=e.isOpen;e.isOpen=!0,H||(e.calendarContainer.classList.add("open"),e._input.classList.add("active"),Dt("onOpen"),Ft(D)),e.config.enableTime===!0&&e.config.noCalendar===!0&&e.config.allowInput===!1&&(x===void 0||!e.timeContainer.contains(x.relatedTarget))&&setTimeout(()=>e.hourElement.select(),50)}function M(x){return D=>{let H=e.config[`_${x}Date`]=e.parseDate(D,e.config.dateFormat),U=e.config[`_${x==="min"?"max":"min"}Date`];H!==void 0&&(e[x==="min"?"minDateHasTime":"maxDateHasTime"]=H.getHours()>0||H.getMinutes()>0||H.getSeconds()>0),e.selectedDates&&(e.selectedDates=e.selectedDates.filter(Q=>Ot(Q)),!e.selectedDates.length&&x==="min"&&c(H),Pt()),e.daysContainer&&(kt(),H!==void 0?e.currentYearElement[x]=H.getFullYear().toString():e.currentYearElement.removeAttribute(x),e.currentYearElement.disabled=!!U&&H!==void 0&&U.getFullYear()===H.getFullYear())}}function B(){let x=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],D=Object.assign(Object.assign({},JSON.parse(JSON.stringify(n.dataset||{}))),t),H={};e.config.parseDate=D.parseDate,e.config.formatDate=D.formatDate,Object.defineProperty(e.config,"enable",{get:()=>e.config._enable,set:X=>{e.config._enable=Tn(X)}}),Object.defineProperty(e.config,"disable",{get:()=>e.config._disable,set:X=>{e.config._disable=Tn(X)}});let U=D.mode==="time";if(!D.dateFormat&&(D.enableTime||U)){let X=zt.defaultConfig.dateFormat||An.dateFormat;H.dateFormat=D.noCalendar||U?"H:i"+(D.enableSeconds?":S":""):X+" H:i"+(D.enableSeconds?":S":"")}if(D.altInput&&(D.enableTime||U)&&!D.altFormat){let X=zt.defaultConfig.altFormat||An.altFormat;H.altFormat=D.noCalendar||U?"h:i"+(D.enableSeconds?":S K":" K"):X+` h:i${D.enableSeconds?":S":""} K`}Object.defineProperty(e.config,"minDate",{get:()=>e.config._minDate,set:M("min")}),Object.defineProperty(e.config,"maxDate",{get:()=>e.config._maxDate,set:M("max")});let Q=X=>at=>{e.config[X==="min"?"_minTime":"_maxTime"]=e.parseDate(at,"H:i:S")};Object.defineProperty(e.config,"minTime",{get:()=>e.config._minTime,set:Q("min")}),Object.defineProperty(e.config,"maxTime",{get:()=>e.config._maxTime,set:Q("max")}),D.mode==="time"&&(e.config.noCalendar=!0,e.config.enableTime=!0),Object.assign(e.config,H,D);for(let X=0;X<x.length;X++)e.config[x[X]]=e.config[x[X]]===!0||e.config[x[X]]==="true";Oo.filter(X=>e.config[X]!==void 0).forEach(X=>{e.config[X]=Ro(e.config[X]||[]).map(o)}),e.isMobile=!e.config.disableMobile&&!e.config.inline&&e.config.mode==="single"&&!e.config.disable.length&&!e.config.enable&&!e.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(let X=0;X<e.config.plugins.length;X++){let at=e.config.plugins[X](e)||{};for(let rt in at)Oo.indexOf(rt)>-1?e.config[rt]=Ro(at[rt]).map(o).concat(e.config[rt]):typeof D[rt]>"u"&&(e.config[rt]=at[rt])}D.altInputClass||(e.config.altInputClass=N().className+" "+e.config.altInputClass),Dt("onParseConfig")}function N(){return e.config.wrap?n.querySelector("[data-input]"):n}function Et(){typeof e.config.locale!="object"&&typeof zt.l10ns[e.config.locale]>"u"&&e.config.errorHandler(new Error(`flatpickr: invalid locale ${e.config.locale}`)),e.l10n=Object.assign(Object.assign({},zt.l10ns.default),typeof e.config.locale=="object"?e.config.locale:e.config.locale!=="default"?zt.l10ns[e.config.locale]:void 0),pr.K=`(${e.l10n.amPM[0]}|${e.l10n.amPM[1]}|${e.l10n.amPM[0].toLowerCase()}|${e.l10n.amPM[1].toLowerCase()})`,Object.assign(Object.assign({},t),JSON.parse(JSON.stringify(n.dataset||{}))).time_24hr===void 0&&zt.defaultConfig.time_24hr===void 0&&(e.config.time_24hr=e.l10n.time_24hr),e.formatDate=ja(e),e.parseDate=No({config:e.config,l10n:e.l10n})}function Ft(x){if(typeof e.config.position=="function")return void e.config.position(e,x);if(e.calendarContainer===void 0)return;Dt("onPreCalendarPosition");let D=x||e._positionElement,H=Array.prototype.reduce.call(e.calendarContainer.children,(Ai,$o)=>Ai+$o.offsetHeight,0),U=e.calendarContainer.offsetWidth,Q=e.config.position.split(" "),X=Q[0],at=Q.length>1?Q[1]:null,rt=D.getBoundingClientRect(),mt=window.innerHeight-rt.bottom,vt=X==="above"||X!=="below"&&mt<H&&rt.top>H,Lt=window.pageYOffset+rt.top+(vt?-H-2:D.offsetHeight+2);if(he(e.calendarContainer,"arrowTop",!vt),he(e.calendarContainer,"arrowBottom",vt),e.config.inline)return;let Te=window.pageXOffset+rt.left,ie=!1,gr=!1;at==="center"?(Te-=(U-rt.width)/2,ie=!0):at==="right"&&(Te-=U-rt.width,gr=!0),he(e.calendarContainer,"arrowLeft",!ie&&!gr),he(e.calendarContainer,"arrowCenter",ie),he(e.calendarContainer,"arrowRight",gr);let Ge=window.document.body.offsetWidth-(window.pageXOffset+rt.right),Ci=Te+U>window.document.body.offsetWidth,Si=Ge+U>window.document.body.offsetWidth;if(he(e.calendarContainer,"rightMost",Ci),!e.config.static)if(e.calendarContainer.style.top=`${Lt}px`,!Ci)e.calendarContainer.style.left=`${Te}px`,e.calendarContainer.style.right="auto";else if(!Si)e.calendarContainer.style.left="auto",e.calendarContainer.style.right=`${Ge}px`;else{let Ai=Kt();if(Ai===void 0)return;let $o=window.document.body.offsetWidth,dd=Math.max(0,$o/2-U/2),fd=".flatpickr-calendar.centerMost:before",pd=".flatpickr-calendar.centerMost:after",md=Ai.cssRules.length,gd=`{left:${rt.left}px;right:auto;}`;he(e.calendarContainer,"rightMost",!1),he(e.calendarContainer,"centerMost",!0),Ai.insertRule(`${fd},${pd}${gd}`,md),e.calendarContainer.style.left=`${dd}px`,e.calendarContainer.style.right="auto"}}function Kt(){let x=null;for(let D=0;D<document.styleSheets.length;D++){let H=document.styleSheets[D];try{H.cssRules}catch{continue}x=H;break}return x??te()}function te(){let x=document.createElement("style");return document.head.appendChild(x),x.sheet}function kt(){e.config.noCalendar||e.isMobile||(L(),wt(),P())}function de(){e._input.focus(),window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==void 0?setTimeout(e.close,0):e.close()}function Ve(x){x.preventDefault(),x.stopPropagation();let D=at=>at.classList&&at.classList.contains("flatpickr-day")&&!at.classList.contains("flatpickr-disabled")&&!at.classList.contains("notAllowed"),H=Ha(we(x),D);if(H===void 0)return;let U=H,Q=e.latestSelectedDateObj=new Date(U.dateObj.getTime()),X=(Q.getMonth()<e.currentMonth||Q.getMonth()>e.currentMonth+e.config.showMonths-1)&&e.config.mode!=="range";if(e.selectedDateElem=U,e.config.mode==="single")e.selectedDates=[Q];else if(e.config.mode==="multiple"){let at=it(Q);at?e.selectedDates.splice(parseInt(at),1):e.selectedDates.push(Q)}else e.config.mode==="range"&&(e.selectedDates.length===2&&e.clear(!1,!1),e.latestSelectedDateObj=Q,e.selectedDates.push(Q),_e(Q,e.selectedDates[0],!0)!==0&&e.selectedDates.sort((at,rt)=>at.getTime()-rt.getTime()));if(s(),X){let at=e.currentYear!==Q.getFullYear();e.currentYear=Q.getFullYear(),e.currentMonth=Q.getMonth(),at&&(Dt("onYearChange"),L()),Dt("onMonthChange")}if(wt(),P(),Pt(),!X&&e.config.mode!=="range"&&e.config.showMonths===1?C(U):e.selectedDateElem!==void 0&&e.hourElement===void 0&&e.selectedDateElem&&e.selectedDateElem.focus(),e.hourElement!==void 0&&e.hourElement!==void 0&&e.hourElement.focus(),e.config.closeOnSelect){let at=e.config.mode==="single"&&!e.config.enableTime,rt=e.config.mode==="range"&&e.selectedDates.length===2&&!e.config.enableTime;(at||rt)&&de()}m()}let Ue={locale:[Et,Y],showMonths:[A,l,j],minDate:[g],maxDate:[g],clickOpens:[()=>{e.config.clickOpens===!0?(p(e._input,"focus",e.open),p(e._input,"click",e.open)):(e._input.removeEventListener("focus",e.open),e._input.removeEventListener("click",e.open))}]};function $n(x,D){if(x!==null&&typeof x=="object"){Object.assign(e.config,x);for(let H in x)Ue[H]!==void 0&&Ue[H].forEach(U=>U())}else e.config[x]=D,Ue[x]!==void 0?Ue[x].forEach(H=>H()):Oo.indexOf(x)>-1&&(e.config[x]=Ro(D));e.redraw(),Pt(!0)}function En(x,D){let H=[];if(x instanceof Array)H=x.map(U=>e.parseDate(U,D));else if(x instanceof Date||typeof x=="number")H=[e.parseDate(x,D)];else if(typeof x=="string")switch(e.config.mode){case"single":case"time":H=[e.parseDate(x,D)];break;case"multiple":H=x.split(e.config.conjunction).map(U=>e.parseDate(U,D));break;case"range":H=x.split(e.l10n.rangeSeparator).map(U=>e.parseDate(U,D));break;default:break}else e.config.errorHandler(new Error(`Invalid date supplied: ${JSON.stringify(x)}`));e.selectedDates=e.config.allowInvalidPreload?H:H.filter(U=>U instanceof Date&&Ot(U,!1)),e.config.mode==="range"&&e.selectedDates.sort((U,Q)=>U.getTime()-Q.getTime())}function Zn(x,D=!1,H=e.config.dateFormat){if(x!==0&&!x||x instanceof Array&&x.length===0)return e.clear(D);En(x,H),e.latestSelectedDateObj=e.selectedDates[e.selectedDates.length-1],e.redraw(),g(void 0,D),c(),e.selectedDates.length===0&&e.clear(!1),Pt(D),D&&Dt("onChange")}function Tn(x){return x.slice().map(D=>typeof D=="string"||typeof D=="number"||D instanceof Date?e.parseDate(D,void 0,!0):D&&typeof D=="object"&&D.from&&D.to?{from:e.parseDate(D.from,void 0),to:e.parseDate(D.to,void 0)}:D).filter(D=>D)}function qo(){e.selectedDates=[],e.now=e.parseDate(e.config.now)||new Date;let x=e.config.defaultDate||((e.input.nodeName==="INPUT"||e.input.nodeName==="TEXTAREA")&&e.input.placeholder&&e.input.value===e.input.placeholder?null:e.input.value);x&&En(x,e.config.dateFormat),e._initialDate=e.selectedDates.length>0?e.selectedDates[0]:e.config.minDate&&e.config.minDate.getTime()>e.now.getTime()?e.config.minDate:e.config.maxDate&&e.config.maxDate.getTime()<e.now.getTime()?e.config.maxDate:e.now,e.currentYear=e._initialDate.getFullYear(),e.currentMonth=e._initialDate.getMonth(),e.selectedDates.length>0&&(e.latestSelectedDateObj=e.selectedDates[0]),e.config.minTime!==void 0&&(e.config.minTime=e.parseDate(e.config.minTime,"H:i")),e.config.maxTime!==void 0&&(e.config.maxTime=e.parseDate(e.config.maxTime,"H:i")),e.minDateHasTime=!!e.config.minDate&&(e.config.minDate.getHours()>0||e.config.minDate.getMinutes()>0||e.config.minDate.getSeconds()>0),e.maxDateHasTime=!!e.config.maxDate&&(e.config.maxDate.getHours()>0||e.config.maxDate.getMinutes()>0||e.config.maxDate.getSeconds()>0)}function Yo(){if(e.input=N(),!e.input){e.config.errorHandler(new Error("Invalid input element specified"));return}e.input._type=e.input.type,e.input.type="text",e.input.classList.add("flatpickr-input"),e._input=e.input,e.config.altInput&&(e.altInput=_t(e.input.nodeName,e.config.altInputClass),e._input=e.altInput,e.altInput.placeholder=e.input.placeholder,e.altInput.disabled=e.input.disabled,e.altInput.required=e.input.required,e.altInput.tabIndex=e.input.tabIndex,e.altInput.type="text",e.input.setAttribute("type","hidden"),!e.config.static&&e.input.parentNode&&e.input.parentNode.insertBefore(e.altInput,e.input.nextSibling)),e.config.allowInput||e._input.setAttribute("readonly","readonly"),e._positionElement=e.config.positionElement||e._input}function Ko(){let x=e.config.enableTime?e.config.noCalendar?"time":"datetime-local":"date";e.mobileInput=_t("input",e.input.className+" flatpickr-mobile"),e.mobileInput.tabIndex=1,e.mobileInput.type=x,e.mobileInput.disabled=e.input.disabled,e.mobileInput.required=e.input.required,e.mobileInput.placeholder=e.input.placeholder,e.mobileFormatStr=x==="datetime-local"?"Y-m-d\\TH:i:S":x==="date"?"Y-m-d":"H:i:S",e.selectedDates.length>0&&(e.mobileInput.defaultValue=e.mobileInput.value=e.formatDate(e.selectedDates[0],e.mobileFormatStr)),e.config.minDate&&(e.mobileInput.min=e.formatDate(e.config.minDate,"Y-m-d")),e.config.maxDate&&(e.mobileInput.max=e.formatDate(e.config.maxDate,"Y-m-d")),e.input.getAttribute("step")&&(e.mobileInput.step=String(e.input.getAttribute("step"))),e.input.type="hidden",e.altInput!==void 0&&(e.altInput.type="hidden");try{e.input.parentNode&&e.input.parentNode.insertBefore(e.mobileInput,e.input.nextSibling)}catch{}p(e.mobileInput,"change",D=>{e.setDate(we(D).value,!1,e.mobileFormatStr),Dt("onChange"),Dt("onClose")})}function Xo(x){if(e.isOpen===!0)return e.close();e.open(x)}function Dt(x,D){if(e.config===void 0)return;let H=e.config[x];if(H!==void 0&&H.length>0)for(let U=0;H[U]&&U<H.length;U++)H[U](e.selectedDates,e.input.value,e,D);x==="onChange"&&(e.input.dispatchEvent(G("change")),e.input.dispatchEvent(G("input")))}function G(x){let D=document.createEvent("Event");return D.initEvent(x,!0,!0),D}function it(x){for(let D=0;D<e.selectedDates.length;D++)if(_e(e.selectedDates[D],x)===0)return""+D;return!1}function ct(x){return e.config.mode!=="range"||e.selectedDates.length<2?!1:_e(x,e.selectedDates[0])>=0&&_e(x,e.selectedDates[1])<=0}function wt(){e.config.noCalendar||e.isMobile||!e.monthNav||(e.yearElements.forEach((x,D)=>{let H=new Date(e.currentYear,e.currentMonth,1);H.setMonth(e.currentMonth+D),e.config.showMonths>1||e.config.monthSelectorType==="static"?e.monthElements[D].textContent=fr(H.getMonth(),e.config.shorthandCurrentMonth,e.l10n)+" ":e.monthsDropdownContainer.value=H.getMonth().toString(),x.value=H.getFullYear().toString()}),e._hidePrevMonthArrow=e.config.minDate!==void 0&&(e.currentYear===e.config.minDate.getFullYear()?e.currentMonth<=e.config.minDate.getMonth():e.currentYear<e.config.minDate.getFullYear()),e._hideNextMonthArrow=e.config.maxDate!==void 0&&(e.currentYear===e.config.maxDate.getFullYear()?e.currentMonth+1>e.config.maxDate.getMonth():e.currentYear>e.config.maxDate.getFullYear()))}function gt(x){return e.selectedDates.map(D=>e.formatDate(D,x)).filter((D,H,U)=>e.config.mode!=="range"||e.config.enableTime||U.indexOf(D)===H).join(e.config.mode!=="range"?e.config.conjunction:e.l10n.rangeSeparator)}function Pt(x=!0){e.mobileInput!==void 0&&e.mobileFormatStr&&(e.mobileInput.value=e.latestSelectedDateObj!==void 0?e.formatDate(e.latestSelectedDateObj,e.mobileFormatStr):""),e.input.value=gt(e.config.dateFormat),e.altInput!==void 0&&(e.altInput.value=gt(e.config.altFormat)),x!==!1&&Dt("onValueUpdate")}function ve(x){let D=we(x),H=e.prevMonthNav.contains(D),U=e.nextMonthNav.contains(D);H||U?Z(H?-1:1):e.yearElements.indexOf(D)>=0?D.select():D.classList.contains("arrowUp")?e.changeYear(e.currentYear+1):D.classList.contains("arrowDown")&&e.changeYear(e.currentYear-1)}function cn(x){x.preventDefault();let D=x.type==="keydown",H=we(x),U=H;e.amPM!==void 0&&H===e.amPM&&(e.amPM.textContent=e.l10n.amPM[be(e.amPM.textContent===e.l10n.amPM[0])]);let Q=parseFloat(U.getAttribute("min")),X=parseFloat(U.getAttribute("max")),at=parseFloat(U.getAttribute("step")),rt=parseInt(U.value,10),mt=x.delta||(D?x.which===38?1:-1:0),vt=rt+at*mt;if(typeof U.value<"u"&&U.value.length===2){let Lt=U===e.hourElement,Te=U===e.minuteElement;vt<Q?(vt=X+vt+be(!Lt)+(be(Lt)&&be(!e.amPM)),Te&&b(void 0,-1,e.hourElement)):vt>X&&(vt=U===e.hourElement?vt-X-be(!e.amPM):Q,Te&&b(void 0,1,e.hourElement)),e.amPM&&Lt&&(at===1?vt+rt===23:Math.abs(vt-rt)>at)&&(e.amPM.textContent=e.l10n.amPM[be(e.amPM.textContent===e.l10n.amPM[0])]),U.value=ue(vt)}}return r(),e}function wi(n,t){let e=Array.prototype.slice.call(n).filter(r=>r instanceof HTMLElement),i=[];for(let r=0;r<e.length;r++){let o=e[r];try{if(o.getAttribute("data-fp-omit")!==null)continue;o._flatpickr!==void 0&&(o._flatpickr.destroy(),o._flatpickr=void 0),o._flatpickr=pv(o,t||{}),i.push(o._flatpickr)}catch(l){console.error(l)}}return i.length===1?i[0]:i}typeof HTMLElement<"u"&&typeof HTMLCollection<"u"&&typeof NodeList<"u"&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(n){return wi(this,n)},HTMLElement.prototype.flatpickr=function(n){return wi([this],n)});var zt=function(n,t){return typeof n=="string"?wi(window.document.querySelectorAll(n),t):n instanceof Node?wi([n],t):wi(n,t)};zt.defaultConfig={};zt.l10ns={en:Object.assign({},Io),default:Object.assign({},Io)};zt.localize=n=>{zt.l10ns.default=Object.assign(Object.assign({},zt.l10ns.default),n)};zt.setDefaults=n=>{zt.defaultConfig=Object.assign(Object.assign({},zt.defaultConfig),n)};zt.parseDate=No({});zt.formatDate=ja({});zt.compareDates=_e;typeof jQuery<"u"&&typeof jQuery.fn<"u"&&(jQuery.fn.flatpickr=function(n){return wi(this,n)});Date.prototype.fp_incr=function(n){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof n=="string"?parseInt(n,10):n))};typeof window<"u"&&(window.flatpickr=zt);var Fh=zt;function mv(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function Bh(n,t){for(var e=0;e<t.length;e++){var i=t[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}function gv(n,t,e){return t&&Bh(n.prototype,t),e&&Bh(n,e),n}function Uh(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function Hh(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),e.push.apply(e,i)}return e}function vv(n){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Hh(Object(e),!0).forEach(function(i){Uh(n,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):Hh(Object(e)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(e,i))})}return n}function yv(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),t&&Va(n,t)}function Bo(n){return Bo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Bo(n)}function Va(n,t){return Va=Object.setPrototypeOf||function(i,r){return i.__proto__=r,i},Va(n,t)}function bv(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function wv(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function _v(n,t){return t&&(typeof t=="object"||typeof t=="function")?t:wv(n)}function Cv(n){return function(){var t=Bo(n),e;if(bv()){var i=Bo(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return _v(this,e)}}function Sv(n){return n.replace(/(?:[_-])([a-z0-9])/g,(t,e)=>e.toUpperCase())}function Ua(n){return n.charAt(0).toUpperCase()+n.slice(1)}function Av(n){return n.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`)}function Gh(n,t){let e=zh(n);return Array.from(e.reduce((i,r)=>(Tv(r,t).forEach(o=>i.add(o)),i),new Set))}function Ev(n,t){return zh(n).reduce((i,r)=>(i.push(...xv(r,t)),i),[])}function zh(n){let t=[];for(;n;)t.push(n),n=Object.getPrototypeOf(n);return t.reverse()}function Tv(n,t){let e=n[t];return Array.isArray(e)?e:[]}function xv(n,t){let e=n[t];return e?Object.keys(e).map(i=>[i,e[i]]):[]}var tE=(()=>{function n(e){function i(){return Reflect.construct(e,arguments,new.target)}return i.prototype=Object.create(e.prototype,{constructor:{value:i}}),Reflect.setPrototypeOf(i,e),i}function t(){let i=n(function(){this.a.call(this)});return i.prototype.a=function(){},new i}try{return t(),n}catch{return i=>class extends i{}}})();function kv(n){return Gh(n,"classes").reduce((e,i)=>Object.assign(e,Dv(i)),{})}function Dv(n){return{[`${n}Class`]:{get(){let{classes:t}=this;if(t.has(n))return t.get(n);{let e=t.getAttributeName(n);throw new Error(`Missing attribute "${e}"`)}}},[`${n}Classes`]:{get(){return this.classes.getAll(n)}},[`has${Ua(n)}Class`]:{get(){return this.classes.has(n)}}}}function Lv(n){return Gh(n,"targets").reduce((e,i)=>Object.assign(e,Pv(i)),{})}function Pv(n){return{[`${n}Target`]:{get(){let t=this.targets.find(n);if(t)return t;throw new Error(`Missing target element "${n}" for "${this.identifier}" controller`)}},[`${n}Targets`]:{get(){return this.targets.findAll(n)}},[`has${Ua(n)}Target`]:{get(){return this.targets.has(n)}}}}function Ov(n){let t=Ev(n,"values"),e={valueDescriptorMap:{get(){return t.reduce((i,r)=>{let o=qh(r),l=this.data.getAttributeNameForKey(o.key);return Object.assign(i,{[l]:o})},{})}}};return t.reduce((i,r)=>Object.assign(i,Mv(r)),e)}function Mv(n){let t=qh(n),{key:e,name:i,reader:r,writer:o}=t;return{[i]:{get(){let l=this.data.get(e);return l!==null?r(l):t.defaultValue},set(l){l===void 0?this.data.delete(e):this.data.set(e,o(l))}},[`has${Ua(i)}`]:{get(){return this.data.has(e)||t.hasCustomDefaultValue}}}}function qh([n,t]){return Fv(n,t)}function Ga(n){switch(n){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function za(n){switch(typeof n){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(n))return"array";if(Object.prototype.toString.call(n)==="[object Object]")return"object"}function Iv(n){let t=Ga(n.type);if(t){let e=za(n.default);if(t!==e)throw new Error(`Type "${t}" must match the type of the default value. Given default value: "${n.default}" as "${e}"`);return t}}function Rv(n){let t=Iv(n),e=za(n),i=Ga(n),r=t||e||i;if(r)return r;throw new Error(`Unknown value type "${n}"`)}function Nv(n){let t=Ga(n);if(t)return Bv[t];let e=n.default;return e!==void 0?e:n}function Fv(n,t){let e=`${Av(n)}-value`,i=Rv(t);return{type:i,key:e,name:Sv(e),get defaultValue(){return Nv(t)},get hasCustomDefaultValue(){return za(t)!==void 0},reader:Hv[i],writer:Wh[i]||Wh.default}}var Bv={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Hv={array(n){let t=JSON.parse(n);if(!Array.isArray(t))throw new TypeError("Expected array");return t},boolean(n){return!(n=="0"||n=="false")},number(n){return Number(n)},object(n){let t=JSON.parse(n);if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError("Expected object");return t},string(n){return n}},Wh={default:Wv,array:jh,object:jh};function jh(n){return JSON.stringify(n)}function Wv(n){return`${n}`}var mr=class{constructor(t){this.context=t}static get shouldLoad(){return!0}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:e=this.element,detail:i={},prefix:r=this.identifier,bubbles:o=!0,cancelable:l=!0}={}){let a=r?`${r}:${t}`:t,h=new CustomEvent(a,{detail:i,bubbles:o,cancelable:l});return e.dispatchEvent(h),h}};mr.blessings=[kv,Lv,Ov];mr.targets=[];mr.values={};var jv=n=>n.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Vv=n=>n.charAt(0).toUpperCase()+n.slice(1),Uv=["allowInput","altInput","animate","clickOpens","closeOnSelect","disableMobile","enableSeconds","enableTime","inline","noCalendar","shorthandCurrentMonth","static","time_24hr","weekNumbers","wrap"],Gv=["altInputClass","conjunction","mode","nextArrow","position","prevArrow","monthSelectorType"],zv=["defaultHour","defaultMinute","defaultSeconds","hourIncrement","minuteIncrement","showMonths"],qv=["disable","enable","disableDaysOfWeek","enableDaysOfWeek"],Yv=["defaultDate"],Kv=["maxDate","minDate","maxTime","minTime","now"],Xv=["altFormat","ariaDateFormat","dateFormat"],Vh={string:Gv,boolean:Uv,date:Kv,array:qv,number:zv,arrayOrString:Yv},$v=["change","open","close","monthChange","yearChange","ready","valueUpdate","dayCreate"],Zv=["calendarContainer","currentYearElement","days","daysContainer","input","nextMonthNav","monthNav","prevMonthNav","rContainer","selectedDateElem","todayDateElem","weekdayContainer"],Yh={"%Y":"Y","%y":"y","%C":"Y","%m":"m","%-m":"n","%_m":"n","%B":"F","%^B":"F","%b":"M","%^b":"M","%h":"M","%^h":"M","%d":"d","%-d":"j","%e":"j","%H":"H","%k":"H","%I":"h","%l":"h","%-l":"h","%P":"K","%p":"K","%M":"i","%S":"S","%A":"l","%a":"D","%w":"w"},Jv=new RegExp(Object.keys(Yh).join("|").replace(new RegExp("\\^","g"),"\\^"),"g"),Qv=n=>n.replace(Jv,t=>Yh[t]),Kh=function(n){yv(e,n);var t=Cv(e);function e(){return mv(this,e),t.apply(this,arguments)}return gv(e,[{key:"initialize",value:function(){this.config={}}},{key:"connect",value:function(){this._initializeEvents(),this._initializeOptions(),this._initializeDateFormats(),this.fp=Fh(this.flatpickrElement,vv({},this.config)),this._initializeElements()}},{key:"disconnect",value:function(){let r=this.inputTarget.value;this.fp.destroy(),this.inputTarget.value=r}},{key:"_initializeEvents",value:function(){$v.forEach(r=>{if(this[r]){let o=`on${Vv(r)}`;this.config[o]=this[r].bind(this)}})}},{key:"_initializeOptions",value:function(){Object.keys(Vh).forEach(r=>{Vh[r].forEach(l=>{let a=jv(l);this.data.has(a)&&(this.config[l]=this[`_${r}`](a))})}),this._handleDaysOfWeek()}},{key:"_handleDaysOfWeek",value:function(){this.config.disableDaysOfWeek&&(this.config.disableDaysOfWeek=this._validateDaysOfWeek(this.config.disableDaysOfWeek),this.config.disable=[...this.config.disable||[],this._disable.bind(this)]),this.config.enableDaysOfWeek&&(this.config.enableDaysOfWeek=this._validateDaysOfWeek(this.config.enableDaysOfWeek),this.config.enable=[...this.config.enable||[],this._enable.bind(this)])}},{key:"_validateDaysOfWeek",value:function(r){return Array.isArray(r)?r.map(o=>parseInt(o)):(console.error("days of week must be a valid array"),[])}},{key:"_disable",value:function(r){return this.config.disableDaysOfWeek.includes(r.getDay())}},{key:"_enable",value:function(r){return this.config.enableDaysOfWeek.includes(r.getDay())}},{key:"_initializeDateFormats",value:function(){Xv.forEach(r=>{this.data.has(r)&&(this.config[r]=Qv(this.data.get(r)))})}},{key:"_initializeElements",value:function(){Zv.forEach(r=>{this[`${r}Target`]=this.fp[r]})}},{key:"_string",value:function(r){return this.data.get(r)}},{key:"_date",value:function(r){return this.data.get(r)}},{key:"_boolean",value:function(r){return!(this.data.get(r)=="0"||this.data.get(r)=="false")}},{key:"_array",value:function(r){return JSON.parse(this.data.get(r))}},{key:"_number",value:function(r){return parseInt(this.data.get(r))}},{key:"_arrayOrString",value:function(r){let o=this.data.get(r);try{return JSON.parse(o)}catch{return o}}},{key:"flatpickrElement",get:function(){return this.hasInstanceTarget&&this.instanceTarget||this.element}}]),e}(mr);Uh(Kh,"targets",["instance"]);var Xh=Kh;Ph.forEach(n=>{Me.register(n.name,n.module.default)});Me.register("dropdown",yi);Me.register("modal",cr);Me.register("tabs",Do);Me.register("popover",Lo);Me.register("toggle",ur);Me.register("slideover",Po);Me.register("flatpickr",Xh);var Ka=qe(ea());var Ho=class{constructor(t){this.response=t}get statusCode(){return this.response.status}get redirected(){return this.response.redirected}get ok(){return this.response.ok}get unauthenticated(){return this.statusCode===401}get unprocessableEntity(){return this.statusCode===422}get authenticationURL(){return this.response.headers.get("WWW-Authenticate")}get contentType(){return(this.response.headers.get("Content-Type")||"").replace(/;.*$/,"")}get headers(){return this.response.headers}get html(){return this.contentType.match(/^(application|text)\/(html|xhtml\+xml)$/)?this.text:Promise.reject(new Error(`Expected an HTML response but got "${this.contentType}" instead`))}get json(){return this.contentType.match(/^application\/.*json$/)?this.responseJson||(this.responseJson=this.response.json()):Promise.reject(new Error(`Expected a JSON response but got "${this.contentType}" instead`))}get text(){return this.responseText||(this.responseText=this.response.text())}get isTurboStream(){return this.contentType.match(/^text\/vnd\.turbo-stream\.html/)}async renderTurboStream(){if(this.isTurboStream)window.Turbo?await window.Turbo.renderStreamMessage(await this.text):console.warn("You must set `window.Turbo = Turbo` to automatically process Turbo Stream events with request.js");else return Promise.reject(new Error(`Expected a Turbo Stream response but got "${this.contentType}" instead`))}};var Wo=class{static register(t){this.interceptor=t}static get(){return this.interceptor}static reset(){this.interceptor=void 0}};function $h(n){let t=document.cookie?document.cookie.split("; "):[],e=`${encodeURIComponent(n)}=`,i=t.find(r=>r.startsWith(e));if(i){let r=i.split("=").slice(1).join("=");if(r)return decodeURIComponent(r)}}function Zh(n){let t={};for(let e in n){let i=n[e];i!==void 0&&(t[e]=i)}return t}function qa(n){let t=document.head.querySelector(`meta[name="${n}"]`);return t&&t.content}function Jh(n){return[...n].reduce((t,[e,i])=>t.concat(typeof i=="string"?[[e,i]]:[]),[])}function Qh(n,t){for(let[e,i]of t)i instanceof window.File||(n.has(e)?(n.delete(e),n.set(e,i)):n.append(e,i))}var jo=class{constructor(t,e,i={}){this.method=t,this.options=i,this.originalUrl=e.toString()}async perform(){try{let e=Wo.get();e&&await e(this)}catch(e){console.error(e)}let t=new Ho(await window.fetch(this.url,this.fetchOptions));return t.unauthenticated&&t.authenticationURL?Promise.reject(window.location.href=t.authenticationURL):(t.ok&&t.isTurboStream&&await t.renderTurboStream(),t)}addHeader(t,e){let i=this.additionalHeaders;i[t]=e,this.options.headers=i}get fetchOptions(){return{method:this.method.toUpperCase(),headers:this.headers,body:this.formattedBody,signal:this.signal,credentials:"same-origin",redirect:this.redirect}}get headers(){return Zh(Object.assign({"X-Requested-With":"XMLHttpRequest","X-CSRF-Token":this.csrfToken,"Content-Type":this.contentType,Accept:this.accept},this.additionalHeaders))}get csrfToken(){return $h(qa("csrf-param"))||qa("csrf-token")}get contentType(){return this.options.contentType?this.options.contentType:this.body==null||this.body instanceof window.FormData?void 0:this.body instanceof window.File?this.body.type:"application/json"}get accept(){switch(this.responseKind){case"html":return"text/html, application/xhtml+xml";case"turbo-stream":return"text/vnd.turbo-stream.html, text/html, application/xhtml+xml";case"json":return"application/json, application/vnd.api+json";default:return"*/*"}}get body(){return this.options.body}get query(){let t=(this.originalUrl.split("?")[1]||"").split("#")[0],e=new URLSearchParams(t),i=this.options.query;i instanceof window.FormData?i=Jh(i):i instanceof window.URLSearchParams?i=i.entries():i=Object.entries(i||{}),Qh(e,i);let r=e.toString();return r.length>0?`?${r}`:""}get url(){return this.originalUrl.split("?")[0].split("#")[0]+this.query}get responseKind(){return this.options.responseKind||"html"}get signal(){return this.options.signal}get redirect(){return this.options.redirect||"follow"}get additionalHeaders(){return this.options.headers||{}}get formattedBody(){let t=Object.prototype.toString.call(this.body)==="[object String]";return this.headers["Content-Type"]==="application/json"&&!t?JSON.stringify(this.body):this.body}};async function Ya(n,t){return new jo("get",n,t).perform()}Ka.default.config.textAttributes.inlineCode={tagName:"code",inheritable:!0};var td=class{constructor(t){this.patterns=void 0,this.element=t,this.editor=t.editor,this.toolbar=t.toolbarElement,this.injectHTML(),this.hrefElement=this.toolbar.querySelector("[data-trix-input][name='href']"),this.embedContainerElement=this.toolbar.querySelector("[data-behavior='embed_container']"),this.embedElement=this.toolbar.querySelector("[data-behavior='embed_url']"),this.reset(),this.installEventHandlers()}injectHTML(){this.toolbar.querySelector('[data-trix-dialog="href"]').insertAdjacentHTML("beforeend",`
        <div data-behavior="embed_container">
          <div class="link_to_embed link_to_embed--new">
            Would you like to embed media from this site?
            <input class="btn btn-tertiary btn-small outline" type="button" data-behavior="embed_url" value="Yes, embed it">
          </div>
        </div>
    `)}installEventHandlers(){this.hrefElement.addEventListener("input",this.didInput.bind(this)),this.hrefElement.addEventListener("focusin",this.didInput.bind(this)),this.embedElement.addEventListener("click",this.embed.bind(this))}didInput(t){let e=t.target.value.trim();this.patterns===void 0?this.loadPatterns(e):this.match(e)?this.fetch(e):this.reset()}async loadPatterns(t){let e=await Ya("/action_text/embeds/patterns.json",{responseKind:"json"});if(e.ok){let i=await e.json;this.patterns=i.map(r=>new RegExp(r.source,r.options)),this.match(t)&&this.fetch(t)}}match(t){return this.patterns.some(e=>e.test(t))}fetch(t){Rails.ajax({url:`/action_text/embeds?id=${encodeURIComponent(t)}`,type:"post",error:this.reset.bind(this),success:this.showEmbed.bind(this)})}embed(t){if(this.currentEmbed==null)return;let e=new Ka.default.Attachment(this.currentEmbed);this.editor.insertAttachment(e),this.element.focus()}showEmbed(t){this.currentEmbed=t,this.embedContainerElement.style.display="block"}reset(){this.embedContainerElement.style.display="none",this.currentEmbed=null}},ed=class{constructor(t){this.element=t,this.editor=t.editor,this.toolbar=t.toolbarElement,this.installEventHandlers()}installEventHandlers(){let t=this.toolbar.querySelector("[data-trix-attribute=code]"),e=t.cloneNode(!0);e.hidden=!0,e.dataset.trixAttribute="inlineCode",t.insertAdjacentElement("afterend",e),this.element.addEventListener("trix-selection-change",i=>{let r=this.getCodeFormattingType();t.hidden=r=="inline",e.hidden=r=="block"})}getCodeFormattingType(){if(this.editor.attributeIsActive("code"))return"block";if(this.editor.attributeIsActive("inlineCode"))return"inline";let t=this.editor.getSelectedRange();if(t[0]==t[1])return"block";let e=this.editor.getSelectedDocument().toString().trim();return/\n/.test(e)?"block":"inline"}};document.addEventListener("trix-initialize",function(n){new td(n.target),new ed(n.target)});var BE=qe(nd()),HE=qe(id()),WE=qe(rd());function Uo(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var i in e)n[i]=e[i]}return n}var oy={read:function(n){return n[0]==='"'&&(n=n.slice(1,-1)),n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(n){return encodeURIComponent(n).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Xa(n,t){function e(r,o,l){if(!(typeof document>"u")){l=Uo({},t,l),typeof l.expires=="number"&&(l.expires=new Date(Date.now()+l.expires*864e5)),l.expires&&(l.expires=l.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var h in l)!l[h]||(a+="; "+h,l[h]!==!0&&(a+="="+l[h].split(";")[0]));return document.cookie=r+"="+n.write(o,r)+a}}function i(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var o=document.cookie?document.cookie.split("; "):[],l={},a=0;a<o.length;a++){var h=o[a].split("="),f=h.slice(1).join("=");try{var s=decodeURIComponent(h[0]);if(l[s]=n.read(f,s),r===s)break}catch{}}return r?l[r]:l}}return Object.create({set:e,get:i,remove:function(r,o){e(r,"",Uo({},o,{expires:-1}))},withAttributes:function(r){return Xa(this.converter,Uo({},this.attributes,r))},withConverter:function(r){return Xa(Uo({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(n)}})}var sy=Xa(oy,{path:"/"}),od=sy;var $a=qe(ld());function ay(){let n=window.Intl;try{window.Intl=void 0;let t=$a.default.determine().name();return window.Intl=n,t}catch{return $a.default.determine().name()}}document.addEventListener("turbo:load",()=>{od.set("browser_time_zone",ay(),{expires:365,path:"/",secure:!0})});var cd=class{static toggleNavBar(){let t=new CustomEvent("toggle-nav-bar");window.dispatchEvent(t)}static setNotificationCount(t,e=t){this.postMessage("showNotificationBadge",{icon:t,tab:e})}static postMessage(t,e={}){window.webkit?.messageHandlers?.nativeApp?.postMessage({name:t,...e}),window.nativeApp?.postMessage(JSON.stringify({name:t,...e}))}};window.TurboNativeBridge=cd;window.Rails=Za.default;window.Turbo=kn;ms().start();hd().start();Za.default.start();var _i=document.createElement("script");_i.id="allchs";_i.src="https://cdn.jsdelivr.net/npm/hockeystack@latest/hockeystack.min.js";_i.async=1;_i.dataset.apikey="86f90fbe34980e327dfef556aa6c19";_i.dataset.cookieless=1;document.getElementsByTagName("head")[0].append(_i);})();
/*!
I tried deleting package-lock.json and yarn.lock and then running rails javascript:build, rails assets:clean and rails assets:precompile but nothing seems to work.

When I run everything locally with RAILS_ENV=production bin/dev, everything works.

This is my production.rb:

require 'active_support/core_ext/integer/time'

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both threaded web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is turned on.
  config.consider_all_requests_local = false
  config.action_controller.perform_caching = true

  # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
  # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
  # config.require_master_key = true

  # Disable serving static files from the `/public` folder by default since
  # Apache or NGINX already handles this.
  # config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?

  # Compress CSS using a preprocessor.
  config.assets.css_compressor = nil

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = false

  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
  # config.action_controller.asset_host = 'http://assets.example.com'

  # Specifies the header that your server uses for sending files.
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

  # Store uploaded files on Linode Object Storage (see config/storage.yml for options).
  config.active_storage.service = :linode

  # Mount Action Cable outside main process or domain.
  # config.action_cable.mount_path = nil
  # config.action_cable.url = 'wss://example.com/cable'
  # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true

  # Use the lowest log level to ensure availability of diagnostic information
  # when problems arise.
  config.log_level = :info

  # Prepend all log lines with the following tags.
  config.log_tags = [:request_id]

  # Use a different cache store in production.
  config.cache_store = :redis_cache_store, { url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') }

  # Use a real queuing backend for Active Job (and separate queues per environment).
  # config.active_job.queue_adapter     = :resque
  # config.active_job.queue_name_prefix = "rails6_production"

  config.action_mailer.perform_caching = false

  # Ignore bad email addresses and do not raise email delivery errors.
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
  # config.action_mailer.raise_delivery_errors = false

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation cannot be found).
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners.
  config.active_support.deprecation = :notify

  # Use default logging formatter so that PID and timestamp are not suppressed.
  config.log_formatter = ::Logger::Formatter.new

  # Use a different logger for distributed setups.
  # require 'syslog/logger'
  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

  if ENV['RAILS_LOG_TO_STDOUT'].present?
    logger = ActiveSupport::Logger.new($stdout)
    logger.formatter = config.log_formatter
    config.logger = ActiveSupport::TaggedLogging.new(logger)
  end

  # Do not dump schema after migrations.
  config.active_record.dump_schema_after_migration = false
end


Any idea what's wrong? Maybe I forgot a step?

Thanks
Benjamin Houy
Ok so I managed to make it work by changing esbuild config so it doesn't minify JS files in production. Considering minification is not very useful (I think), I will just leave it like that for now.
Notifications
You’re not receiving notifications from this thread.