/*! For license information please see index.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["factit-lib"]=e():t["factit-lib"]=e()}(this,(()=>(()=>{"use strict";var t={893:(t,e,n)=>{n.d(e,{Z:()=>i}),t=n.hmd(t);var r=r||function(t){if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var e=t.document,n=function(){return t.URL||t.webkitURL||t},r=e.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,i=t.webkitRequestFileSystem,a=t.requestFileSystem||i||t.mozRequestFileSystem,c=function(e){(t.setImmediate||t.setTimeout)((function(){throw e}),0)},s="application/octet-stream",u=0,l=function(e){var r=function(){"string"==typeof e?n().revokeObjectURL(e):e.remove()};t.chrome?r():setTimeout(r,500)},f=function(t,e,n){for(var r=(e=[].concat(e)).length;r--;){var o=t["on"+e[r]];if("function"==typeof o)try{o.call(t,n||t)}catch(t){c(t)}}},p=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t},y=function(c,y){c=p(c);var h,v,d,m,b,g=this,w=c.type,O=!1,j=function(){f(g,"writestart progress write writeend".split(" "))},E=function(){!O&&h||(h=n().createObjectURL(c)),v?v.location.href=h:null==t.open(h,"_blank")&&"undefined"!=typeof safari&&(t.location.href=h),g.readyState=g.DONE,j(),l(h)},S=function(t){return function(){if(g.readyState!==g.DONE)return t.apply(this,arguments)}},P={create:!0,exclusive:!1};if(g.readyState=g.INIT,y||(y="download"),o)return h=n().createObjectURL(c),r.href=h,r.download=y,m=r,(b=e.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,t,0,0,0,0,0,!1,!1,!1,!1,0,null),m.dispatchEvent(b),g.readyState=g.DONE,j(),void l(h);t.chrome&&w&&w!==s&&(d=c.slice||c.webkitSlice,c=d.call(c,0,c.size,s),O=!0),i&&"download"!==y&&(y+=".download"),(w===s||i)&&(v=t),a?(u+=c.size,a(t.TEMPORARY,u,S((function(t){t.root.getDirectory("saved",P,S((function(t){var e=function(){t.getFile(y,P,S((function(t){t.createWriter(S((function(e){e.onwriteend=function(e){v.location.href=t.toURL(),g.readyState=g.DONE,f(g,"writeend",e),l(t)},e.onerror=function(){var t=e.error;t.code!==t.ABORT_ERR&&E()},"writestart progress write abort".split(" ").forEach((function(t){e["on"+t]=g["on"+t]})),e.write(c),g.abort=function(){e.abort(),g.readyState=g.DONE},g.readyState=g.WRITING})),E)})),E)};t.getFile(y,{create:!1},S((function(t){t.remove(),e()})),S((function(t){t.code===t.NOT_FOUND_ERR?e():E()})))})),E)})),E)):E()},h=y.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e){return navigator.msSaveOrOpenBlob(p(t),e)}:(h.abort=function(){var t=this;t.readyState=t.DONE,f(t,"abort")},h.readyState=h.INIT=0,h.WRITING=1,h.DONE=2,h.error=h.onwritestart=h.onprogress=h.onwrite=h.onabort=h.onerror=h.onwriteend=null,function(t,e){return new y(t,e)})}alert("Veuillez Utiliser un autre navigateur, L'application Factit n'est supporte par le navigateur ie")}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||(void 0).content),o=o||void 0;t.exports?t.exports.saveAs=r:null!=o&&null!=o.amd&&o([],(function(){return r}));const i=r}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={id:r,loaded:!1,exports:{}};return t[r](i,i.exports,n),i.loaded=!0,i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{n.r(r),n.d(r,{Btn:()=>dn,Button:()=>_n,ButtonLnk:()=>zn,Card:()=>ki,CardAction:()=>Ii,CardContent:()=>Zi,CardImage:()=>va,CardTitle:()=>oa,Col:()=>fc,CollapsBody:()=>Jr,CollapsElement:()=>so,CollapsTrigger:()=>wo,Collapsible:()=>Wr,Collection:()=>Zc,CollectionItem:()=>os,Cube:()=>Sa,DateField:()=>qe,EmailField:()=>U,Field:()=>D,FieldTrigger:()=>Kt,Flash:()=>kc,FlashMessage:()=>Hu,Form:()=>v,FormActions:()=>Zn,IconSideLink:()=>bi,Icons:()=>t,InnerPage:()=>qa,Loader:()=>Sc,Logo:()=>or,Overlay:()=>Da,PasswordField:()=>ee,PhoneField:()=>Oe,PostCodeField:()=>fe,RadioIcons:()=>Ic,Row:()=>ec,SideCollapsible:()=>xo,SideLink:()=>Fo,SideMenu:()=>Sr,SideMenuItem:()=>Mr,SideNav:()=>hr,SidenavEl:()=>Yo,SidenavSearch:()=>ci,Signature_Cmp:()=>Cs,StokeBtn:()=>an,Tabs:()=>wc,TextArea:()=>Te,Toast:()=>zu,Waves:()=>$e,saveAs:()=>is.Z});var t={};n.r(t),n.d(t,{AddIcon:()=>et,AssuranceIcon:()=>xt,AttachementIcon:()=>ot,BarCharttIcon:()=>vt,BellIcon:()=>mt,BugIcon:()=>bt,CancelIcon:()=>tt,CarIcon:()=>ut,CheveronDown:()=>G,CheveronLeft:()=>X,CheveronRight:()=>K,CheveronUp:()=>Z,ClientIcon:()=>ct,CompanyIcon:()=>Mt,DeleteIcon:()=>nt,DisconnectIcon:()=>dt,DocIcon:()=>Ot,DownloadIcon:()=>gt,EditIcon:()=>rt,EuroIcon:()=>Tt,EyeDropperIcon:()=>at,EyeIcon:()=>it,FemaleIcon:()=>pt,HomeIcon:()=>Bt,InvoiceIcon:()=>St,MailIcon:()=>Rt,MaleIcon:()=>ft,MenuIcon:()=>yt,MinusCircle:()=>Y,OrIcon:()=>Pt,PackageIcon:()=>Nt,PasswordIcon:()=>zt,PdfIcon:()=>jt,PhoneIcon:()=>Dt,PieChartIcon:()=>ht,PlusCircle:()=>Q,ProductIcon:()=>Lt,ProfileIcon:()=>lt,QuotationIcon:()=>_t,SaveIcon:()=>J,SearchIcon:()=>Ct,SettingIcon:()=>kt,UploadIcon:()=>wt,UserIcon:()=>st,ZipIcon:()=>Et});var e={};n.r(e),n.d(e,{P:()=>t});const o=require("react");var i=n.n(o);function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(){return c=Object.assign?Object.assign.bind():function(t){for(var e=1;e>t/4).toString(16)}))}},{key:"render",value:function(){return i().createElement("div",{style:{color:"red"}},"Vous n'avez pas implementez la method render")}}])&&m(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),e}(i().Component);try{E.displayName="Commun"}catch(t){}const S=E,P=require("@d3v4pp/rex");var _=n.n(P);function C(t){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},C(t)}function k(t,e){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];if(t&&this.setState({focusCount:this.state.focusCount+1}),this.state.focusCount>0||t){var e=this.props,n=e.min,r=e.max,o=e.required,i=e.vtype,a=e.vtypeMsg;if(""!==this.el.value){var c=this.el.value.length;return n&&r&&(cr)?(this.setState({errmsg:n!=r?"la longueur doit être comprise entre ".concat(n," et ").concat(r," caractères."):"doit avoir une longueur de ".concat(n," caractères")}),this.el.classList.remove("valid"),this.el.classList.add("invalid"),this.invalidate(),!1):!n&&r&&c>r?(this.setState({errmsg:"doit avoir une longueur maximale de ".concat(r," caractères.")}),this.el.classList.remove("valid"),this.el.classList.add("invalid"),this.invalidate(),!1):n&&!r&&c>t/4).toString(16)}))}},{key:"getErrorView",value:function(){if(null!=this.state.errmsg&&""!==this.state.errmsg)return i().createElement("div",{className:"helper-text"},this.state.errmsg)}},{key:"render",value:function(){var t=this;return i().createElement("div",{className:"input-field"},i().createElement("label",{ref:function(e){return t.label=e},htmlFor:this.id,className:this.state.labelClassName},this.props.label+(!0===this.props.required?" *":"")),i().createElement("input",{ref:function(e){t.el=e},"data-role":this.props["data-role"],value:this.props.value||"",placeholder:this.props.placeholder,onChange:this.props.onChange||function(){},onFocus:function(e){return t.onFocus.bind(t)(e)},type:this.props.type||"text",disabled:this.props.disabled||!1,autoFocus:this.props.autoFocus||!1,"data-cy":this.props["data-cy"],onBlur:function(e){return t.onBlur.bind(t)(e)},onKeyUp:this.onKeyUp.bind(this),id:this.id,className:"validate "+this.props.className}),this.getErrorView())}}],r&&k(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),e}(S);try{B.displayName="Field"}catch(t){}B.defaultProps={type:"text",className:"",placeholder:"",label:""};const D=B;function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}function z(t,e){for(var n=0;n1&&this.isValid()}},{key:"uuidv4",value:function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))}},{key:"render",value:function(){var t=this;return i().createElement("div",{className:"input-field"},i().createElement("label",{ref:function(e){return t.label=e},htmlFor:this.id,className:this.state.labelClassName},this.props.label),i().createElement("input",{ref:function(e){t.el=e},"data-cy":this.props["data-cy"],placeholder:this.props.placeholder,value:this.props.value,type:"text",onChange:this.props.onChange,onFocus:function(e){return t.onFocus.bind(t)(e)},onBlur:function(e){return t.onBlur.bind(t)(e)},onKeyUp:this.onKeyDown.bind(this),autoFocus:this.props.autoFocus||!1,id:this.id,disabled:this.props.disabled,className:"validate "+this.props.className}),this.getErrorView())}}])&&z(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),e}(D);try{W.displayName="EmailField"}catch(t){}W.defaultProps={type:"email",enterkey:function(){},icon:"at",className:"",placeholder:"",label:""};const U=W;function q(){return q=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&void 0!==arguments[0]&&arguments[0];if(t&&this.setState({focusCount:this.state.focusCount+1}),this.state.focusCount>0||t){var e=this.props,n=e.min,r=e.max,o=e.required,i=e.vtype,a=e.vtypeMsg;if(""!==this.el.value){var c=this.el.value.length;return n&&r&&(cr)?(this.setState({errmsg:n!=r?"la longueur doit être comprise entre ".concat(n," et ").concat(r," caractères."):"doit avoir une longueur de ".concat(n," caractères")}),this.el.classList.remove("valid"),this.el.classList.add("invalid"),this.invalidate(),!1):!n&&r&&c>r?(this.setState({errmsg:"doit avoir une longueur maximale de ".concat(r," caractères.")}),this.el.classList.remove("valid"),this.el.classList.add("invalid"),this.invalidate(),!1):n&&!r&&c>t/4).toString(16)}))}},{key:"getErrorView",value:function(){if(null!=this.state.errmsg&&""!==this.state.errmsg)return i().createElement("div",{className:"helper-text"},this.state.errmsg)}},{key:"getAddBtn",value:function(){var t=this;if(this.props.trigger)return i().createElement("button",{className:"webo second white-text",onClick:function(e){t.props.onTrigger&&"function"==typeof t.props.onTrigger&&t.props.onTrigger(e)}},i().createElement(et,{style:{height:"25px",width:"25px"}})," ")}},{key:"render",value:function(){var t=this;return i().createElement("div",{className:"inputFieldTrigger "},i().createElement("label",{ref:function(e){return t.label=e},htmlFor:this.id,className:this.state.labelClassName||""},this.props.label+(this.props.required?"*":"")),i().createElement("input",{ref:function(e){t.el=e},placeholder:this.props.placeholder,className:"validate "+this.props.className,value:this.props.value||"",onChange:this.props.onChange||function(){},onFocus:function(e){return t.onFocus.bind(t)(e)},type:this.props.type||"text",disabled:this.props.disabled||!1,autoFocus:this.props.autoFocus||!1,"data-cy":this.props["data-cy"],onBlur:function(e){return t.onBlur.bind(t)(e)},onKeyPress:this.onKeyUp.bind(this),id:this.id}),this.getAddBtn())}}],r&&Vt(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),e}(S);try{qt.displayName="FieldTrigger"}catch(t){}qt.defaultProps={trigger:!0,type:"text",className:"",placeholder:"",label:""};const Kt=qt;function Xt(t){return Xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xt(t)}function Zt(t,e){for(var n=0;n0)return this.state.error.map((function(t,e){return i().createElement("div",{key:e,className:"helper-text"},t)}))}},{key:"isPasswordValid",value:function(t){var e=function(t,e,n){var r=[];return t.length<8&&r.push("Au minimum 8 caractères"),t.length>32&&r.push("Au maximum 32 caractères"),!(r.length>0)||r}(t),n=!0===e?[]:e;return t.match(/[0-9]/)||n.push("Au minimum 1 caractère numérique"),t.match(/[a-z]/)||n.push("Au minimum 1 caractère minuscule"),t.match(/[A-Z]/)||n.push("Au minimum 1 caractère majuscule"),t.match(/[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/)||n.push("Au minimum 1 caractère special"),!(n.length>0)||n}},{key:"isValid",value:function(){var t=this.isPasswordValid(this.el.value);return!0===t?(this.setState({error:null}),this.el.classList.remove("invalid"),this.el.classList.add("valid"),!0):(this.setState({error:t}),this.el.classList.remove("valid"),this.el.classList.add("invalid"),!1)}},{key:"setValue",value:function(t){this.el.current.value=t,""!=t&&this.label.classList.add("active")}},{key:"getIcon",value:function(){var t=this;return""!==this.props.icon?i().createElement("i",{ref:function(e){return t.icon=e},className:"s-icon prefix"},this.props.icon):null}},{key:"onBlur",value:function(){""!=this.props.placeholder||this.el&&""!=this.el.value?this.label.classList.contains("active")||this.label.classList.add("active"):this.label.classList.remove("active"),"function"==typeof this.props.onBlur&&this.onBlur(),this.isValid()}},{key:"onFocus",value:function(){this.label.classList.contains("active")||this.label.classList.add("active"),this.setState({focusCount:this.state.focusCount+1})}},{key:"componentDidMount",value:function(){(""!=this.props.placeholder||this.el&&""!=this.el.value)&&(this.label.classList.add("active"),this.setState({labelClassName:"active"}))}},{key:"onKeyDown",value:function(t){this.isValid(),""==t.target.value?(this.label.classList.remove("active"),this.setState({labelClassName:""})):(this.label.classList.add("active"),this.setState({labelClassName:"active"})),"Enter"==t.key&&this.props.enteraction&&this.props.enteraction(t),this.state.focusCount>1&&this.isValid()}},{key:"uuidv4",value:function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))}},{key:"render",value:function(){var t=this;return i().createElement(i().Fragment,null,i().createElement("label",{ref:function(e){return t.label=e},htmlFor:this.id,className:this.state.labelClassName},this.props.label),i().createElement("input",{ref:function(e){t.el=e},autoComplete:this.props.autoComplete||"on",placeholder:this.props.placeholder,value:this.props.value,onChange:this.props.onChange,type:"password","data-cy":this.props["data-cy"],onFocus:function(e){return t.onFocus.bind(t)(e)},onBlur:function(e){return t.onBlur.bind(t)(e)},onKeyPress:this.onKeyDown.bind(this),autoFocus:this.props.autoFocus||!1,id:this.id,name:this.id,className:"validate "+this.props.className}),this.getErrorView())}}])&&Zt(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),e}(D);try{te.displayName="PasswordFIeld"}catch(t){}te.defaultProps={type:"password",icon:"dialpad",enterkey:function(){},className:"",placeholder:"",label:""};const ee=te;function ne(t){return ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ne(t)}function re(){return re=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&void 0!==arguments[0]&&arguments[0];if(t&&this.setState({focusCount:this.state.focusCount+1}),this.state.focusCount>0||t){var e=this.props,n=e.min,r=e.max,o=e.required,i=e.vtype,a=e.vtypeMsg;if(""!==this.el.value){var c=this.el.value.length;return n&&r&&(cr)?(this.setState({errmsg:n!=r?"doit avoir une longeur comprise entre ".concat(n," et ").concat(r,"."):"doit avoir une longeur de ".concat(n," caractères")}),this.el.classList.remove("valid"),this.el.classList.add("invalid"),this.invalidate(),!1):!n&&r&&c>r?(this.setState({errmsg:"doit avoir une longeur maximal de ".concat(r,".")}),this.el.classList.remove("valid"),this.el.classList.add("invalid"),this.invalidate(),!1):n&&!r&&c>t/4).toString(16)}))}},{key:"getErrorView",value:function(){if(null!=this.state.errmsg&&""!==this.state.errmsg)return i().createElement("div",{className:"helper-text"},this.state.errmsg)}},{key:"render",value:function(){var t=this;return i().createElement("div",{className:"input-field"},i().createElement("label",{ref:function(e){return t.label=e},htmlFor:this.id,className:this.state.labelClassName},this.props.label+(!0===this.props.required?" *":"")),i().createElement(Ee(),{ref:function(e){t.el=e},value:this.props.value||"",onChange:this.props.onChange||function(){},disabled:this.props.disabled||!1,onFocus:function(e){return t.onFocus.bind(t)(e)},onBlur:function(e){return t.onBlur.bind(t)(e)},"data-cy":this.props["data-cy"],onKeyUp:this.onKeyUp.bind(this),id:this.id,minRows:"4",className:"textarea "+this.props.className}),this.getErrorView())}}],r&&Pe(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),e}(i().Component);try{Ne.displayName="Field"}catch(t){}Ne.defaultProps={enteraction:function(){},type:"text",className:"",placeholder:"",label:""};const Te=Ne,Me=require("react-datepicker");var Be=n.n(Me);require("react-datepicker/dist/react-datepicker.css");const De=require("date-fns/locale/fr");var Re=n.n(De);function ze(t){return ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ze(t)}function Ie(t,e){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];if(t&&this.setState({focusCount:this.state.focusCount+1}),this.state.focusCount>0||t){var e=this.props,n=e.required,r=e.vtype,o=e.vtypeMsg;if(""===this.el.input.value)return n?(this.setState({errmsg:"Ne doit pas être vide."}),this.invalidate(),!1):(this.setState({errmsg:""}),this.el.input.classList.remove("invalid"),this.el.input.classList.add("valid"),!0);var i=Date.now(),a=this.el.input.value.split("/"),c=a[0];a[0]=a[1],a[1]=c;var s=Date.parse(a.join("/")+" 23:59");switch(this.setState({errmsg:""}),r){case"future":return i>s?(this.setState({errmsg:o||"Doit être dans le future."}),this.el.input.classList.remove("valid"),this.el.input.classList.add("invalid"),!1):(this.setState({errmsg:""}),this.el.input.classList.remove("invalid"),this.el.input.classList.add("valid"),!0);case"past":return it.length)&&(e=t.length);for(var n=0,r=new Array(e);n0){var c=i-t,s=a-e;n+=Math.sqrt(c*c+s*s)}t=i,e=a}return n}},{key:"point",value:function(t,e,n,r,o){return e*(1-t)*(1-t)*(1-t)+3*n*(1-t)*(1-t)*t+3*r*(1-t)*t*t+o*t*t*t}}],[{key:"fromPoints",value:function(e,n){var r=this.calculateControlPoints(e[0],e[1],e[2]).c2,o=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new t(e[1],r,o,e[2],n.start,n.end)}},{key:"calculateControlPoints",value:function(t,e,n){var r=t.x-e.x,o=t.y-e.y,i=e.x-n.x,a=e.y-n.y,c=(t.x+e.x)/2,s=(t.y+e.y)/2,u=(e.x+n.x)/2,l=(e.y+n.y)/2,f=Math.sqrt(r*r+o*o),p=Math.sqrt(i*i+a*a),y=p/(f+p),h=u+(c-u)*y,v=l+(s-l)*y,d=e.x-h,m=e.y-v;return{c1:new ds(c+d,s+m),c2:new ds(u+d,l+m)}}}]),t}(),bs=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ps(this,e),(n=cs(this,e)).canvas=t,n._drawingStroke=!1,n._isEmpty=!0,n._lastPoints=[],n._data=[],n._lastVelocity=0,n._lastWidth=0,n._handleMouseDown=function(t){1===t.buttons&&n._strokeBegin(t)},n._handleMouseMove=function(t){n._strokeMoveUpdate(t)},n._handleMouseUp=function(t){1===t.buttons&&n._strokeEnd(t)},n._handleTouchStart=function(t){if(t.cancelable&&t.preventDefault(),1===t.targetTouches.length){var e=t.changedTouches[0];n._strokeBegin(e)}},n._handleTouchMove=function(t){t.cancelable&&t.preventDefault();var e=t.targetTouches[0];n._strokeMoveUpdate(e)},n._handleTouchEnd=function(t){if(t.target===n.canvas){t.cancelable&&t.preventDefault();var e=t.changedTouches[0];n._strokeEnd(e)}},n._handlePointerStart=function(t){t.preventDefault(),n._strokeBegin(t)},n._handlePointerMove=function(t){n._strokeMoveUpdate(t)},n._handlePointerEnd=function(t){n._drawingStroke&&(t.preventDefault(),n._strokeEnd(t))},n.velocityFilterWeight=r.velocityFilterWeight||.7,n.minWidth=r.minWidth||.5,n.maxWidth=r.maxWidth||2.5,n.throttle="throttle"in r?r.throttle:16,n.minDistance="minDistance"in r?r.minDistance:5,n.dotSize=r.dotSize||0,n.penColor=r.penColor||"black",n.backgroundColor=r.backgroundColor||"rgba(0,0,0,0)",n.compositeOperation=r.compositeOperation||"source-over",n._strokeMoveUpdate=n.throttle?function(t){var e,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,i=0,a=null,c=function(){i=Date.now(),a=null,e=t.apply(n,r),a||(n=null,r=[])};return function(){var s=Date.now(),u=o-(s-i);n=this;for(var l=arguments.length,f=new Array(l),p=0;po?(a&&(clearTimeout(a),a=null),i=s,e=t.apply(n,r),a||(n=null,r=[])):a||(a=window.setTimeout(c,u)),e}}(e.prototype._strokeUpdate,n.throttle):e.prototype._strokeUpdate,n._ctx=t.getContext("2d"),n.clear(),n.on(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ls(t,e)}(e,t),hs(e,[{key:"clear",value:function(){var t=this._ctx,e=this.canvas;t.fillStyle=this.backgroundColor,t.clearRect(0,0,e.width,e.height),t.fillRect(0,0,e.width,e.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0}},{key:"fromDataURL",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(r,o){var i=new Image,a=n.ratio||window.devicePixelRatio||1,c=n.width||e.canvas.width/a,s=n.height||e.canvas.height/a,u=n.xOffset||0,l=n.yOffset||0;e._reset(e._getPointGroupOptions()),i.onload=function(){e._ctx.drawImage(i,u,l,c,s),r()},i.onerror=function(t){o(t)},i.crossOrigin="anonymous",i.src=t,e._isEmpty=!1}))}},{key:"toDataURL",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png",e=arguments.length>1?arguments[1]:void 0;return"image/svg+xml"===t?("object"!==fs(e)&&(e=void 0),"data:image/svg+xml;base64,".concat(btoa(this.toSVG(e)))):("number"!=typeof e&&(e=void 0),this.canvas.toDataURL(t,e))}},{key:"on",value:function(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";var t=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!t?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}},{key:"off",value:function(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerStart),this.canvas.removeEventListener("pointermove",this._handlePointerMove),this.canvas.ownerDocument.removeEventListener("pointerup",this._handlePointerEnd),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("mousemove",this._handleMouseMove),this.canvas.ownerDocument.removeEventListener("mouseup",this._handleMouseUp),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this.canvas.removeEventListener("touchmove",this._handleTouchMove),this.canvas.removeEventListener("touchend",this._handleTouchEnd)}},{key:"isEmpty",value:function(){return this._isEmpty}},{key:"fromData",value:function(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).clear;(void 0===e||e)&&this.clear(),this._fromData(t,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(t)}},{key:"toData",value:function(){return this._data}},{key:"_getPointGroupOptions",value:function(t){return{penColor:t&&"penColor"in t?t.penColor:this.penColor,dotSize:t&&"dotSize"in t?t.dotSize:this.dotSize,minWidth:t&&"minWidth"in t?t.minWidth:this.minWidth,maxWidth:t&&"maxWidth"in t?t.maxWidth:this.maxWidth,velocityFilterWeight:t&&"velocityFilterWeight"in t?t.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:t&&"compositeOperation"in t?t.compositeOperation:this.compositeOperation}}},{key:"_strokeBegin",value:function(t){if(this.dispatchEvent(new CustomEvent("beginStroke",{detail:t,cancelable:!0}))){this._drawingStroke=!0;var e=this._getPointGroupOptions(),n=Object.assign(Object.assign({},e),{points:[]});this._data.push(n),this._reset(e),this._strokeUpdate(t)}}},{key:"_strokeUpdate",value:function(t){if(this._drawingStroke)if(0!==this._data.length){this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:t}));var e=t.clientX,n=t.clientY,r=void 0!==t.pressure?t.pressure:void 0!==t.force?t.force:0,o=this._createPoint(e,n,r),i=this._data[this._data.length-1],a=i.points,c=a.length>0&&a[a.length-1],s=!!c&&o.distanceTo(c)<=this.minDistance,u=this._getPointGroupOptions(i);if(!c||!c||!s){var l=this._addPoint(o,u);c?l&&this._drawCurve(l,u):this._drawDot(o,u),a.push({time:o.time,x:o.x,y:o.y,pressure:o.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:t}))}else this._strokeBegin(t)}},{key:"_strokeEnd",value:function(t){this._drawingStroke&&(this._strokeUpdate(t),this._drawingStroke=!1,this.dispatchEvent(new CustomEvent("endStroke",{detail:t})))}},{key:"_handlePointerEvents",value:function(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerStart),this.canvas.addEventListener("pointermove",this._handlePointerMove),this.canvas.ownerDocument.addEventListener("pointerup",this._handlePointerEnd)}},{key:"_handleMouseEvents",value:function(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown),this.canvas.addEventListener("mousemove",this._handleMouseMove),this.canvas.ownerDocument.addEventListener("mouseup",this._handleMouseUp)}},{key:"_handleTouchEvents",value:function(){this.canvas.addEventListener("touchstart",this._handleTouchStart),this.canvas.addEventListener("touchmove",this._handleTouchMove),this.canvas.addEventListener("touchend",this._handleTouchEnd)}},{key:"_reset",value:function(t){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(t.minWidth+t.maxWidth)/2,this._ctx.fillStyle=t.penColor,this._ctx.globalCompositeOperation=t.compositeOperation}},{key:"_createPoint",value:function(t,e,n){var r=this.canvas.getBoundingClientRect();return new ds(t-r.left,e-r.top,n,(new Date).getTime())}},{key:"_addPoint",value:function(t,e){var n=this._lastPoints;if(n.push(t),n.length>2){3===n.length&&n.unshift(n[0]);var r=this._calculateCurveWidths(n[1],n[2],e),o=ms.fromPoints(n,r);return n.shift(),o}return null}},{key:"_calculateCurveWidths",value:function(t,e,n){var r=n.velocityFilterWeight*e.velocityFrom(t)+(1-n.velocityFilterWeight)*this._lastVelocity,o=this._strokeWidth(r,n),i={end:o,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=o,i}},{key:"_strokeWidth",value:function(t,e){return Math.max(e.maxWidth/(t+1),e.minWidth)}},{key:"_drawCurveSegment",value:function(t,e,n){var r=this._ctx;r.moveTo(t,e),r.arc(t,e,n,0,2*Math.PI,!1),this._isEmpty=!1}},{key:"_drawCurve",value:function(t,e){var n=this._ctx,r=t.endWidth-t.startWidth,o=2*Math.ceil(t.length());n.beginPath(),n.fillStyle=e.penColor;for(var i=0;i0?e.dotSize:(e.minWidth+e.maxWidth)/2;n.beginPath(),this._drawCurveSegment(t.x,t.y,r),n.closePath(),n.fillStyle=e.penColor,n.fill()}},{key:"_fromData",value:function(t,e,n){var r,o=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return as(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?as(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw i}}}}(t);try{for(o.s();!(r=o.n()).done;){var i=r.value,a=i.points,c=this._getPointGroupOptions(i);if(a.length>1)for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:{}).includeBackgroundColor,e=void 0!==t&&t,n=this._data,r=Math.max(window.devicePixelRatio||1,1),o=this.canvas.width/r,i=this.canvas.height/r,a=document.createElementNS("http://www.w3.org/2000/svg","svg");if(a.setAttribute("xmlns","http://www.w3.org/2000/svg"),a.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),a.setAttribute("viewBox","".concat(0," ").concat(0," ").concat(o," ").concat(i)),a.setAttribute("width",o.toString()),a.setAttribute("height",i.toString()),e&&this.backgroundColor){var c=document.createElement("rect");c.setAttribute("width","100%"),c.setAttribute("height","100%"),c.setAttribute("fill",this.backgroundColor),a.appendChild(c)}return this._fromData(n,(function(t,e){var n=e.penColor,r=document.createElement("path");if(!(isNaN(t.control1.x)||isNaN(t.control1.y)||isNaN(t.control2.x)||isNaN(t.control2.y))){var o="M ".concat(t.startPoint.x.toFixed(3),",").concat(t.startPoint.y.toFixed(3)," ")+"C ".concat(t.control1.x.toFixed(3),",").concat(t.control1.y.toFixed(3)," ")+"".concat(t.control2.x.toFixed(3),",").concat(t.control2.y.toFixed(3)," ")+"".concat(t.endPoint.x.toFixed(3),",").concat(t.endPoint.y.toFixed(3));r.setAttribute("d",o),r.setAttribute("stroke-width",(2.25*t.endWidth).toFixed(3)),r.setAttribute("stroke",n),r.setAttribute("fill","none"),r.setAttribute("stroke-linecap","round"),a.appendChild(r)}}),(function(t,e){var n=e.penColor,r=e.dotSize,o=e.minWidth,i=e.maxWidth,c=document.createElement("circle"),s=r>0?r:(o+i)/2;c.setAttribute("r",s.toString()),c.setAttribute("cx",t.x.toString()),c.setAttribute("cy",t.y.toString()),c.setAttribute("fill",n),a.appendChild(c)})),a.outerHTML}}]),e}(function(){function t(){ps(this,t);try{this._et=new EventTarget}catch(t){this._et=document}}return hs(t,[{key:"addEventListener",value:function(t,e,n){this._et.addEventListener(t,e,n)}},{key:"dispatchEvent",value:function(t){return this._et.dispatchEvent(t)}},{key:"removeEventListener",value:function(t,e,n){this._et.removeEventListener(t,e,n)}}]),t}());function gs(t){return gs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gs(t)}function ws(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n-1}function Ds(t,e){return t.apply(null,e)}var Rs={arr:function(t){return Array.isArray(t)},obj:function(t){return Bs(Object.prototype.toString.call(t),"Object")},pth:function(t){return Rs.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||Rs.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},nil:function(t){return Rs.und(t)||null===t},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return Rs.hex(t)||Rs.rgb(t)||Rs.hsl(t)},key:function(t){return!xs.hasOwnProperty(t)&&!Ls.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function zs(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function Is(t,e){var n=zs(t),r=Ms(Rs.und(n[0])?1:n[0],.1,100),o=Ms(Rs.und(n[1])?100:n[1],.1,100),i=Ms(Rs.und(n[2])?10:n[2],.1,100),a=Ms(Rs.und(n[3])?0:n[3],.1,100),c=Math.sqrt(o/r),s=i/(2*Math.sqrt(o*r)),u=s<1?c*Math.sqrt(1-s*s):0,l=s<1?(s*c-a)/u:-a+c;function f(t){var n=e?e*t/1e3:t;return n=s<1?Math.exp(-n*s*c)*(1*Math.cos(u*n)+l*Math.sin(u*n)):(1+l*n)*Math.exp(-n*c),0===t||1===t?t:1-n}return e?f:function(){var e=Ts.springs[t];if(e)return e;for(var n=1/6,r=0,o=0;;)if(1===f(r+=n)){if(++o>=16)break}else o=0;var i=r*n*1e3;return Ts.springs[t]=i,i}}function Vs(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return function(e){return Math.ceil(Ms(e,1e-6,1)*t)*(1/t)}}var As,Fs,Hs=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function n(t,e){return 3*e-6*t}function r(t){return 3*t}function o(t,o,i){return((e(o,i)*t+n(o,i))*t+r(o))*t}function i(t,o,i){return 3*e(o,i)*t*t+2*n(o,i)*t+r(o)}return function(e,n,r,a){if(0<=e&&e<=1&&0<=r&&r<=1){var c=new Float32Array(11);if(e!==n||r!==a)for(var s=0;s<11;++s)c[s]=o(s*t,e,r);return function(s){return e===n&&r===a||0===s||1===s?s:o(function(n){for(var a=0,s=1;10!==s&&c[s]<=n;++s)a+=t;--s;var u=a+(n-c[s])/(c[s+1]-c[s])*t,l=i(u,e,r);return l>=.001?function(t,e,n,r){for(var a=0;a<4;++a){var c=i(e,n,r);if(0===c)return e;e-=(o(e,n,r)-t)/c}return e}(n,u,e,r):0===l?u:function(t,e,n,r,i){var a,c,s=0;do{(a=o(c=e+(n-e)/2,r,i)-t)>0?n=c:e=c}while(Math.abs(a)>1e-7&&++s<10);return c}(n,a,a+t,e,r)}(s),n,a)}}}}(),Ws=(As={linear:function(){return function(t){return t}}},Fs={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Expo:function(){return function(t){return t?Math.pow(2,10*t-10):0}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,e=Ms(arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,1,10),n=Ms(t,.1,2);return function(t){return 0===t||1===t?t:-e*Math.pow(2,10*(t-1))*Math.sin((t-1-n/(2*Math.PI)*Math.asin(1/e))*(2*Math.PI)/n)}}},["Quad","Cubic","Quart","Quint"].forEach((function(t,e){Fs[t]=function(){return function(t){return Math.pow(t,e+2)}}})),Object.keys(Fs).forEach((function(t){var e=Fs[t];As["easeIn"+t]=e,As["easeOut"+t]=function(t,n){return function(r){return 1-e(t,n)(1-r)}},As["easeInOut"+t]=function(t,n){return function(r){return r<.5?e(t,n)(2*r)/2:1-e(t,n)(-2*r+2)/2}},As["easeOutIn"+t]=function(t,n){return function(r){return r<.5?(1-e(t,n)(1-2*r))/2:(e(t,n)(2*r-1)+1)/2}}})),As);function Us(t,e){if(Rs.fnc(t))return t;var n=t.split("(")[0],r=Ws[n],o=zs(t);switch(n){case"spring":return Is(t,e);case"cubicBezier":return Ds(Hs,o);case"steps":return Ds(Vs,o);default:return Ds(r,o)}}function qs(t){try{return document.querySelectorAll(t)}catch(t){return}}function Ks(t,e){for(var n=t.length,r=arguments.length>=2?arguments[1]:void 0,o=[],i=0;i1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}if(0==a)e=n=r=c;else{var l=c<.5?c*(1+a):c+a-c*a,f=2*c-l;e=u(f,l,i+1/3),n=u(f,l,i),r=u(f,l,i-1/3)}return"rgba(".concat(255*e,",").concat(255*n,",").concat(255*r,",").concat(s,")")}(t):void 0;var e,n}(t);if(/\s/g.test(t))return t;var n=Js(t),r=n?t.substr(0,t.length-n.length):t;return e?r+e:r}function uu(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function lu(t){for(var e,n=t.points,r=0,o=0;o0&&(r+=uu(e,i)),e=i}return r}function fu(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*eu(t,"r")}(t);case"rect":return function(t){return 2*eu(t,"width")+2*eu(t,"height")}(t);case"line":return function(t){return uu({x:eu(t,"x1"),y:eu(t,"y1")},{x:eu(t,"x2"),y:eu(t,"y2")})}(t);case"polyline":return lu(t);case"polygon":return function(t){var e=t.points;return lu(t)+uu(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function pu(t,e){var n=e||{},r=n.el||function(t){for(var e=t.parentNode;Rs.svg(e)&&Rs.svg(e.parentNode);)e=e.parentNode;return e}(t),o=r.getBoundingClientRect(),i=eu(r,"viewBox"),a=o.width,c=o.height,s=n.viewBox||(i?i.split(" "):[0,0,a,c]);return{el:r,viewBox:s,x:s[0]/1,y:s[1]/1,w:a,h:c,vW:s[2],vH:s[3]}}function yu(t,e,n){function r(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=e+n>=1?e+n:0;return t.el.getPointAtLength(r)}var o=pu(t.el,t.svg),i=r(),a=r(-1),c=r(1),s=n?1:o.w/o.vW,u=n?1:o.h/o.vH;switch(t.property){case"x":return(i.x-o.x)*s;case"y":return(i.y-o.y)*u;case"angle":return 180*Math.atan2(c.y-a.y,c.x-a.x)/Math.PI}}function hu(t,e){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=su(Rs.pth(t)?t.totalLength:t,e)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:Rs.str(t)||e?r.split(n):[]}}function vu(t){return Ks(t?Xs(Rs.arr(t)?t.map(Zs):Zs(t)):[],(function(t,e,n){return n.indexOf(t)===e}))}function du(t){var e=vu(t);return e.map((function(t,n){return{target:t,id:n,total:e.length,transforms:{list:iu(t)}}}))}function mu(t,e){var n=Gs(e);if(/^spring/.test(n.easing)&&(n.duration=Is(n.easing)),Rs.arr(t)){var r=t.length;2!==r||Rs.obj(t[0])?Rs.fnc(e.duration)||(n.duration=e.duration/r):t={value:t}}var o=Rs.arr(t)?t:[t];return o.map((function(t,n){var r=Rs.obj(t)&&!Rs.pth(t)?t:{value:t};return Rs.und(r.delay)&&(r.delay=n?0:e.delay),Rs.und(r.endDelay)&&(r.endDelay=n===o.length-1?e.endDelay:0),r})).map((function(t){return Qs(t,n)}))}var bu={css:function(t,e,n){return t.style[e]=n},attribute:function(t,e,n){return t.setAttribute(e,n)},object:function(t,e,n){return t[e]=n},transform:function(t,e,n,r,o){if(r.list.set(e,n),e===r.last||o){var i="";r.list.forEach((function(t,e){i+="".concat(e,"(").concat(t,") ")})),t.style.transform=i}}};function gu(t,e){du(t).forEach((function(t){for(var n in e){var r=tu(e[n],t),o=t.target,i=Js(r),a=au(o,n,i,t),c=cu(su(r,i||Js(a)),a),s=ou(o,n);bu[s](o,n,c,t.transforms,!0)}}))}function wu(t,e){return Ks(Xs(t.map((function(t){return e.map((function(e){return function(t,e){var n=ou(t.target,e.name);if(n){var r=function(t,e){var n;return t.tweens.map((function(r){var o=function(t,e){var n={};for(var r in t){var o=tu(t[r],e);Rs.arr(o)&&1===(o=o.map((function(t){return tu(t,e)}))).length&&(o=o[0]),n[r]=o}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(r,e),i=o.value,a=Rs.arr(i)?i[1]:i,c=Js(a),s=au(e.target,t.name,c,e),u=n?n.to.original:s,l=Rs.arr(i)?i[0]:u,f=Js(l)||Js(s),p=c||f;return Rs.und(a)&&(a=u),o.from=hu(l,p),o.to=hu(cu(a,l),p),o.start=n?n.end:0,o.end=o.start+o.delay+o.duration+o.endDelay,o.easing=Us(o.easing,o.duration),o.isPath=Rs.pth(i),o.isPathTargetInsideSVG=o.isPath&&Rs.svg(e.target),o.isColor=Rs.col(o.from.original),o.isColor&&(o.round=1),n=o,o}))}(e,t),o=r[r.length-1];return{type:n,property:e.name,animatable:t,tweens:r,duration:o.end,delay:r[0].delay,endDelay:o.endDelay}}}(t,e)}))}))),(function(t){return!Rs.und(t)}))}function Ou(t,e){var n=t.length,r=function(t){return t.timelineOffset?t.timelineOffset:0},o={};return o.duration=n?Math.max.apply(Math,t.map((function(t){return r(t)+t.duration}))):e.duration,o.delay=n?Math.min.apply(Math,t.map((function(t){return r(t)+t.delay}))):e.delay,o.endDelay=n?o.duration-Math.max.apply(Math,t.map((function(t){return r(t)+t.duration-t.endDelay}))):e.endDelay,o}var ju=0,Eu=[],Su=function(){var t;function e(n){for(var r=Eu.length,o=0;o0?requestAnimationFrame(e):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){_u.suspendWhenDocumentHidden&&(Pu()?t=cancelAnimationFrame(t):(Eu.forEach((function(t){return t._onDocumentVisibility()})),Su()))})),function(){t||Pu()&&_u.suspendWhenDocumentHidden||!(Eu.length>0)||(t=requestAnimationFrame(e))}}();function Pu(){return!!document&&document.hidden}function _u(){var t,e=0,n=0,r=0,o=0,i=null;function a(t){var e=window.Promise&&new Promise((function(t){return i=t}));return t.finished=e,e}var c,s,u,l,f,p,y,h,v=(s=Ys(xs,c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),u=Ys(Ls,c),l=function(t,e){var n=[],r=e.keyframes;for(var o in r&&(e=Qs(function(t){for(var e=Ks(Xs(t.map((function(t){return Object.keys(t)}))),(function(t){return Rs.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),n={},r=function(){var r=e[o];n[r]=t.map((function(t){var e={};for(var n in t)Rs.key(n)?n==r&&(e.value=t[n]):e[n]=t[n];return e}))},o=0;o2||(b=Math.round(b*p)/p)),y.push(b)}var O=f.length;if(O){d=f[0];for(var j=0;j0&&(v.began=!0,O("begin")),!v.loopBegan&&v.currentTime>0&&(v.loopBegan=!0,O("loopBegin")),f<=u&&0!==v.currentTime&&w(0),(f>=l&&v.currentTime!==s||!s)&&w(s),f>u&&f=s&&(n=0,v.remaining&&!0!==v.remaining&&v.remaining--,v.remaining?(e=r,O("loopComplete"),v.loopBegan=!1,"alternate"===v.direction&&d()):(v.paused=!0,v.completed||(v.completed=!0,O("loopComplete"),O("complete"),!v.passThrough&&"Promise"in window&&(i(),a(v)))))}return a(v),v.reset=function(){var e=v.direction;v.passThrough=!1,v.currentTime=0,v.progress=0,v.paused=!0,v.began=!1,v.loopBegan=!1,v.changeBegan=!1,v.completed=!1,v.changeCompleted=!1,v.reversePlayback=!1,v.reversed="reverse"===e,v.remaining=v.loop,t=v.children;for(var n=o=t.length;n--;)v.children[n].reset();(v.reversed&&!0!==v.loop||"alternate"===e&&1===v.loop)&&v.remaining++,w(v.reversed?v.duration:0)},v._onDocumentVisibility=b,v.set=function(t,e){return gu(t,e),v},v.tick=function(t){r=t,e||(e=r),j((r+(n-e))*_u.speed)},v.seek=function(t){j(m(t))},v.pause=function(){v.paused=!0,b()},v.play=function(){v.paused&&(v.completed&&v.reset(),v.paused=!1,Eu.push(v),b(),Su())},v.reverse=function(){d(),v.completed=!v.reversed,b()},v.restart=function(){v.reset(),v.play()},v.remove=function(t){ku(vu(t),v)},v.reset(),v.autoplay&&v.play(),v}function Cu(t,e){for(var n=e.length;n--;)$s(t,e[n].animatable.target)&&e.splice(n,1)}function ku(t,e){var n=e.animations,r=e.children;Cu(t,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;Cu(t,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||e.pause()}_u.version="3.2.2",_u.speed=1,_u.suspendWhenDocumentHidden=!0,_u.running=Eu,_u.remove=function(t){for(var e=vu(t),n=Eu.length;n--;)ku(e,Eu[n])},_u.get=au,_u.set=gu,_u.convertPx=nu,_u.path=function(t,e){var n=Rs.str(t)?qs(t)[0]:t,r=e||100;return function(t){return{property:t,el:n,svg:pu(n),totalLength:fu(n)*(r/100)}}},_u.setDashoffset=function(t){var e=fu(t);return t.setAttribute("stroke-dasharray",e),e},_u.stagger=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.direction||"normal",r=e.easing?Us(e.easing):null,o=e.grid,i=e.axis,a=e.from||0,c="first"===a,s="center"===a,u="last"===a,l=Rs.arr(t),f=l?parseFloat(t[0]):parseFloat(t),p=l?parseFloat(t[1]):0,y=Js(l?t[1]:t)||0,h=e.start||0+(l?f:0),v=[],d=0;return function(t,e,m){if(c&&(a=0),s&&(a=(m-1)/2),u&&(a=m-1),!v.length){for(var b=0;b0&&void 0!==arguments[0]?arguments[0]:{},e=_u(t);return e.duration=0,e.add=function(n,r){var o=Eu.indexOf(e),i=e.children;function a(t){t.passThrough=!0}o>-1&&Eu.splice(o,1);for(var c=0;c0){var n=e.target.parentElement.querySelectorAll(".toast")[0];n.panning=!0,t._draggedToast=n,n.classList.add("panning"),n.style.transition="",n.startingXPos=t._xPos(e),n.time=Date.now(),n.xPos=t._xPos(e)}}},{key:"_onDragMove",value:function(e){if(t._draggedToast){e.preventDefault();var n=t._draggedToast;n.deltaX=Math.abs(n.xPos-t._xPos(e)),n.xPos=t._xPos(e),n.velocityX=n.deltaX/(Date.now()-n.time),n.time=Date.now();var r=n.xPos-n.startingXPos,o=.8*n.offsetWidth;n.style.transform="translateX(".concat(r,"px)"),n.style.opacity=1-Math.abs(r/o)}}},{key:"_onDragEnd",value:function(){if(t._draggedToast){var e=t._draggedToast;e.panning=!1,e.classList.remove("panning");var n=e.xPos-e.startingXPos,r=.8*e.offsetWidth;Math.abs(n)>r||e.velocityX>1?(e.wasSwiped=!0,e.remove()):(e.style.transition="transform .2s, opacity .2s",e.style.transform="",e.style.opacity=""),t._draggedToast=null}}},{key:"_xPos",value:function(t){return t.targetTouches&&t.targetTouches.length>=1?t.targetTouches[0].clientX:t.clientX}},{key:"dismissAll",value:function(){for(var e in t._toasts)t._toasts[e].dismiss()}}],(n=[{key:"_createToast",value:function(){var e=document.createElement("div");return e.classList.add("toast"),this.options.classes.length&&this.options.classes.split(" ").forEach((function(t){e.classList.add(t)})),("object"===("undefined"==typeof HTMLElement?"undefined":Tu(HTMLElement))?this.message instanceof HTMLElement:this.message&&"object"===Tu(this.message)&&null!==this.message&&1===this.message.nodeType&&"string"==typeof this.message.nodeName)?e.appendChild(this.message):this.message.jquery?$(e).append(this.message[0]):e.innerHTML=this.message,t._container.appendChild(e),e}},{key:"_animateIn",value:function(){xu({targets:this.el,top:0,opacity:1,duration:this.options.inDuration,easing:"easeOutCubic"})}},{key:"_setTimer",value:function(){var t=this;this.timeRemaining!==1/0&&(this.counterInterval=setInterval((function(){t.panning||(t.timeRemaining-=20),t.timeRemaining<=0&&t.dismiss()}),20))}},{key:"dismiss",value:function(){var e=this;window.clearInterval(this.counterInterval);var n=this.el.offsetWidth*this.options.activationPercent;this.wasSwiped&&(this.el.style.transition="transform .05s, opacity .05s",this.el.style.transform="translateX(".concat(n,"px)"),this.el.style.opacity=0),xu({targets:this.el,opacity:0,marginTop:-40,duration:this.options.outDuration,easing:"easeOutExpo",complete:function(){"function"==typeof e.options.completeCallback&&e.options.completeCallback(),e.$el.remove(),t._toasts.splice(t._toasts.indexOf(e),1),0===t._toasts.length&&t._removeContainer()}})}}])&&Lu(e.prototype,n),r&&Lu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();Ru._toasts=[],Ru._container=null,Ru._draggedToast=null;const zu=Ru;function Iu(t){return Iu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Iu(t)}function Vu(t,e){for(var n=0;n