menuserver/dist/build/bundle.js
Martin Donnelly 4aa46c2493 feat(server): dockerfying the server
The server has been initially dockerfied. It can be built using `docker-compose build --no-cache`
and using normal docker-compose up and downs

BREAKING CHANGE: The server now runs inside a docker container
2022-10-16 18:37:37 +01:00

3 lines
33 KiB
JavaScript
Executable File

var app=function(){"use strict";function e(){}const t=e=>e;function n(e){return e()}function o(){return Object.create(null)}function r(e){e.forEach(n)}function a(e){return"function"==typeof e}function i(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}const s="undefined"!=typeof window;let u=s?()=>window.performance.now():()=>Date.now(),c=s?e=>requestAnimationFrame(e):e;const l=new Set;function f(e){l.forEach((t=>{t.c(e)||(l.delete(t),t.f())})),0!==l.size&&c(f)}function d(e,t){e.appendChild(t)}function p(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function h(e){const t=v("style");return function(e,t){d(e.head||e,t)}(p(e),t),t}function m(e,t,n){e.insertBefore(t,n||null)}function g(e){e.parentNode.removeChild(e)}function v(e){return document.createElement(e)}function b(e){return document.createTextNode(e)}function y(){return b(" ")}function _(e,t,n,o){return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)}function $(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function x(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function w(e,t){e.value=null==t?"":t}function C(e,t){for(let n=0;n<e.options.length;n+=1){const o=e.options[n];if(o.__value===t)return void(o.selected=!0)}e.selectedIndex=-1}function E(e){const t=e.querySelector(":checked")||e.options[0];return t&&t.__value}const R=new Set;let S,k=0;function A(e,t,n,o,r,a,i,s=0){const u=16.666/o;let c="{\n";for(let e=0;e<=1;e+=u){const o=t+(n-t)*a(e);c+=100*e+`%{${i(o,1-o)}}\n`}const l=c+`100% {${i(n,1-n)}}\n}`,f=`__svelte_${function(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}(l)}_${s}`,d=p(e);R.add(d);const m=d.__svelte_stylesheet||(d.__svelte_stylesheet=h(e).sheet),g=d.__svelte_rules||(d.__svelte_rules={});g[f]||(g[f]=!0,m.insertRule(`@keyframes ${f} ${l}`,m.cssRules.length));const v=e.style.animation||"";return e.style.animation=`${v?`${v}, `:""}${f} ${o}ms linear ${r}ms 1 both`,k+=1,f}function N(e,t){const n=(e.style.animation||"").split(", "),o=n.filter(t?e=>e.indexOf(t)<0:e=>-1===e.indexOf("__svelte")),r=n.length-o.length;r&&(e.style.animation=o.join(", "),k-=r,k||c((()=>{k||(R.forEach((e=>{const t=e.__svelte_stylesheet;let n=t.cssRules.length;for(;n--;)t.deleteRule(n);e.__svelte_rules={}})),R.clear())})))}function O(e){S=e}function T(e){(function(){if(!S)throw new Error("Function called outside component initialization");return S})().$$.on_mount.push(e)}const j=[],B=[],q=[],F=[],U=Promise.resolve();let P=!1;function I(e){q.push(e)}let L=!1;const M=new Set;function D(){if(!L){L=!0;do{for(let e=0;e<j.length;e+=1){const t=j[e];O(t),z(t.$$)}for(O(null),j.length=0;B.length;)B.pop()();for(let e=0;e<q.length;e+=1){const t=q[e];M.has(t)||(M.add(t),t())}q.length=0}while(j.length);for(;F.length;)F.pop()();P=!1,L=!1,M.clear()}}function z(e){if(null!==e.fragment){e.update(),r(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(I)}}let V;function H(e,t,n){e.dispatchEvent(function(e,t,n=!1){const o=document.createEvent("CustomEvent");return o.initCustomEvent(e,n,!1,t),o}(`${t?"intro":"outro"}${n}`))}const X=new Set;let J;function K(){J={r:0,c:[],p:J}}function W(){J.r||r(J.c),J=J.p}function G(e,t){e&&e.i&&(X.delete(e),e.i(t))}function Q(e,t,n,o){if(e&&e.o){if(X.has(e))return;X.add(e),J.c.push((()=>{X.delete(e),o&&(n&&e.d(1),o())})),e.o(t)}}const Y={duration:0};function Z(n,o,i,s){let d=o(n,i),p=s?0:1,h=null,m=null,g=null;function v(){g&&N(n,g)}function b(e,t){const n=e.b-p;return t*=Math.abs(n),{a:p,b:e.b,d:n,duration:t,start:e.start,end:e.start+t,group:e.group}}function y(o){const{delay:a=0,duration:i=300,easing:s=t,tick:y=e,css:_}=d||Y,$={start:u()+a,b:o};o||($.group=J,J.r+=1),h||m?m=$:(_&&(v(),g=A(n,p,o,i,a,s,_)),o&&y(0,1),h=b($,i),I((()=>H(n,o,"start"))),function(e){let t;0===l.size&&c(f),new Promise((n=>{l.add(t={c:e,f:n})}))}((e=>{if(m&&e>m.start&&(h=b(m,i),m=null,H(n,h.b,"start"),_&&(v(),g=A(n,p,h.b,h.duration,0,s,d.css))),h)if(e>=h.end)y(p=h.b,1-p),H(n,h.b,"end"),m||(h.b?v():--h.group.r||r(h.group.c)),h=null;else if(e>=h.start){const t=e-h.start;p=h.a+h.d*s(t/h.duration),y(p,1-p)}return!(!h&&!m)})))}return{run(e){a(d)?(V||(V=Promise.resolve(),V.then((()=>{V=null}))),V).then((()=>{d=d(),y(e)})):y(e)},end(){v(),h=m=null}}}function ee(e){e&&e.c()}function te(e,t,o,i){const{fragment:s,on_mount:u,on_destroy:c,after_update:l}=e.$$;s&&s.m(t,o),i||I((()=>{const t=u.map(n).filter(a);c?c.push(...t):r(t),e.$$.on_mount=[]})),l.forEach(I)}function ne(e,t){const n=e.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function oe(e,t){-1===e.$$.dirty[0]&&(j.push(e),P||(P=!0,U.then(D)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function re(t,n,a,i,s,u,c,l=[-1]){const f=S;O(t);const d=t.$$={fragment:null,ctx:null,props:u,update:e,not_equal:s,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(f?f.$$.context:n.context||[]),callbacks:o(),dirty:l,skip_bound:!1,root:n.target||f.$$.root};c&&c(d.root);let p=!1;if(d.ctx=a?a(t,n.props||{},((e,n,...o)=>{const r=o.length?o[0]:n;return d.ctx&&s(d.ctx[e],d.ctx[e]=r)&&(!d.skip_bound&&d.bound[e]&&d.bound[e](r),p&&oe(t,e)),n})):[],d.update(),p=!0,r(d.before_update),d.fragment=!!i&&i(d.ctx),n.target){if(n.hydrate){const e=function(e){return Array.from(e.childNodes)}(n.target);d.fragment&&d.fragment.l(e),e.forEach(g)}else d.fragment&&d.fragment.c();n.intro&&G(t.$$.fragment),te(t,n.target,n.anchor,n.customElement),D()}O(f)}class ae{$destroy(){ne(this,1),this.$destroy=e}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ie=[];function se(t,n=e){let o;const r=new Set;function a(e){if(i(t,e)&&(t=e,o)){const e=!ie.length;for(const e of r)e[1](),ie.push(e,t);if(e){for(let e=0;e<ie.length;e+=2)ie[e][0](ie[e+1]);ie.length=0}}}return{set:a,update:function(e){a(e(t))},subscribe:function(i,s=e){const u=[i,s];return r.add(u),1===r.size&&(o=n(a)||e),i(t),()=>{r.delete(u),0===r.size&&(o(),o=null)}}}}var ue={exports:{}},ce=function(e,t){return function(){for(var n=new Array(arguments.length),o=0;o<n.length;o++)n[o]=arguments[o];return e.apply(t,n)}},le=ce,fe=Object.prototype.toString;function de(e){return"[object Array]"===fe.call(e)}function pe(e){return void 0===e}function he(e){return null!==e&&"object"==typeof e}function me(e){if("[object Object]"!==fe.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function ge(e){return"[object Function]"===fe.call(e)}function ve(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),de(e))for(var n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(null,e[r],r,e)}var be={isArray:de,isArrayBuffer:function(e){return"[object ArrayBuffer]"===fe.call(e)},isBuffer:function(e){return null!==e&&!pe(e)&&null!==e.constructor&&!pe(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:he,isPlainObject:me,isUndefined:pe,isDate:function(e){return"[object Date]"===fe.call(e)},isFile:function(e){return"[object File]"===fe.call(e)},isBlob:function(e){return"[object Blob]"===fe.call(e)},isFunction:ge,isStream:function(e){return he(e)&&ge(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:ve,merge:function e(){var t={};function n(n,o){me(t[o])&&me(n)?t[o]=e(t[o],n):me(n)?t[o]=e({},n):de(n)?t[o]=n.slice():t[o]=n}for(var o=0,r=arguments.length;o<r;o++)ve(arguments[o],n);return t},extend:function(e,t,n){return ve(t,(function(t,o){e[o]=n&&"function"==typeof t?le(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}},ye=be;function _e(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var $e=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(ye.isURLSearchParams(t))o=t.toString();else{var r=[];ye.forEach(t,(function(e,t){null!=e&&(ye.isArray(e)?t+="[]":e=[e],ye.forEach(e,(function(e){ye.isDate(e)?e=e.toISOString():ye.isObject(e)&&(e=JSON.stringify(e)),r.push(_e(t)+"="+_e(e))})))})),o=r.join("&")}if(o){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e},xe=be;function we(){this.handlers=[]}we.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},we.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},we.prototype.forEach=function(e){xe.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var Ce=we,Ee=be,Re=function(e){return!(!e||!e.__CANCEL__)},Se=be,ke=function(e,t,n,o,r){return e.config=t,n&&(e.code=n),e.request=o,e.response=r,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},Ae=function(e,t,n,o,r){var a=new Error(e);return ke(a,t,n,o,r)},Ne=Ae,Oe=be,Te=Oe.isStandardBrowserEnv()?{write:function(e,t,n,o,r,a){var i=[];i.push(e+"="+encodeURIComponent(t)),Oe.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),Oe.isString(o)&&i.push("path="+o),Oe.isString(r)&&i.push("domain="+r),!0===a&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},je=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},Be=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e},qe=be,Fe=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],Ue=be,Pe=Ue.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(e){var o=e;return t&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=o(window.location.href),function(t){var n=Ue.isString(t)?o(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},Ie=be,Le=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(Ne("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)},Me=Te,De=$e,ze=function(e,t){return e&&!je(t)?Be(e,t):t},Ve=function(e){var t,n,o,r={};return e?(qe.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=qe.trim(e.substr(0,o)).toLowerCase(),n=qe.trim(e.substr(o+1)),t){if(r[t]&&Fe.indexOf(t)>=0)return;r[t]="set-cookie"===t?(r[t]?r[t]:[]).concat([n]):r[t]?r[t]+", "+n:n}})),r):r},He=Pe,Xe=Ae,Je=function(e){return new Promise((function(t,n){var o=e.data,r=e.headers;Ie.isFormData(o)&&delete r["Content-Type"];var a=new XMLHttpRequest;if(e.auth){var i=e.auth.username||"",s=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";r.Authorization="Basic "+btoa(i+":"+s)}var u=ze(e.baseURL,e.url);if(a.open(e.method.toUpperCase(),De(u,e.params,e.paramsSerializer),!0),a.timeout=e.timeout,a.onreadystatechange=function(){if(a&&4===a.readyState&&(0!==a.status||a.responseURL&&0===a.responseURL.indexOf("file:"))){var o="getAllResponseHeaders"in a?Ve(a.getAllResponseHeaders()):null,r={data:e.responseType&&"text"!==e.responseType?a.response:a.responseText,status:a.status,statusText:a.statusText,headers:o,config:e,request:a};Le(t,n,r),a=null}},a.onabort=function(){a&&(n(Xe("Request aborted",e,"ECONNABORTED",a)),a=null)},a.onerror=function(){n(Xe("Network Error",e,null,a)),a=null},a.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(Xe(t,e,"ECONNABORTED",a)),a=null},Ie.isStandardBrowserEnv()){var c=(e.withCredentials||He(u))&&e.xsrfCookieName?Me.read(e.xsrfCookieName):void 0;c&&(r[e.xsrfHeaderName]=c)}if("setRequestHeader"in a&&Ie.forEach(r,(function(e,t){void 0===o&&"content-type"===t.toLowerCase()?delete r[t]:a.setRequestHeader(t,e)})),Ie.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),e.responseType)try{a.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&a.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&a.upload&&a.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){a&&(a.abort(),n(e),a=null)})),o||(o=null),a.send(o)}))},Ke=be,We=function(e,t){Se.forEach(e,(function(n,o){o!==t&&o.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[o])}))},Ge={"Content-Type":"application/x-www-form-urlencoded"};function Qe(e,t){!Ke.isUndefined(e)&&Ke.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Ye,Ze={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(Ye=Je),Ye),transformRequest:[function(e,t){return We(t,"Accept"),We(t,"Content-Type"),Ke.isFormData(e)||Ke.isArrayBuffer(e)||Ke.isBuffer(e)||Ke.isStream(e)||Ke.isFile(e)||Ke.isBlob(e)?e:Ke.isArrayBufferView(e)?e.buffer:Ke.isURLSearchParams(e)?(Qe(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Ke.isObject(e)?(Qe(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};Ze.headers={common:{Accept:"application/json, text/plain, */*"}},Ke.forEach(["delete","get","head"],(function(e){Ze.headers[e]={}})),Ke.forEach(["post","put","patch"],(function(e){Ze.headers[e]=Ke.merge(Ge)}));var et=Ze,tt=be,nt=function(e,t,n){return Ee.forEach(n,(function(n){e=n(e,t)})),e},ot=Re,rt=et;function at(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var it=be,st=function(e,t){t=t||{};var n={},o=["url","method","data"],r=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],i=["validateStatus"];function s(e,t){return it.isPlainObject(e)&&it.isPlainObject(t)?it.merge(e,t):it.isPlainObject(t)?it.merge({},t):it.isArray(t)?t.slice():t}function u(o){it.isUndefined(t[o])?it.isUndefined(e[o])||(n[o]=s(void 0,e[o])):n[o]=s(e[o],t[o])}it.forEach(o,(function(e){it.isUndefined(t[e])||(n[e]=s(void 0,t[e]))})),it.forEach(r,u),it.forEach(a,(function(o){it.isUndefined(t[o])?it.isUndefined(e[o])||(n[o]=s(void 0,e[o])):n[o]=s(void 0,t[o])})),it.forEach(i,(function(o){o in t?n[o]=s(e[o],t[o]):o in e&&(n[o]=s(void 0,e[o]))}));var c=o.concat(r).concat(a).concat(i),l=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return it.forEach(l,u),n},ut=be,ct=$e,lt=Ce,ft=function(e){return at(e),e.headers=e.headers||{},e.data=nt(e.data,e.headers,e.transformRequest),e.headers=tt.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),tt.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||rt.adapter)(e).then((function(t){return at(e),t.data=nt(t.data,t.headers,e.transformResponse),t}),(function(t){return ot(t)||(at(e),t&&t.response&&(t.response.data=nt(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},dt=st;function pt(e){this.defaults=e,this.interceptors={request:new lt,response:new lt}}pt.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=dt(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[ft,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},pt.prototype.getUri=function(e){return e=dt(this.defaults,e),ct(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},ut.forEach(["delete","get","head","options"],(function(e){pt.prototype[e]=function(t,n){return this.request(dt(n||{},{method:e,url:t,data:(n||{}).data}))}})),ut.forEach(["post","put","patch"],(function(e){pt.prototype[e]=function(t,n,o){return this.request(dt(o||{},{method:e,url:t,data:n}))}}));var ht=pt;function mt(e){this.message=e}mt.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},mt.prototype.__CANCEL__=!0;var gt=mt,vt=gt;function bt(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new vt(e),t(n.reason))}))}bt.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},bt.source=function(){var e;return{token:new bt((function(t){e=t})),cancel:e}};var yt=bt,_t=be,$t=ce,xt=ht,wt=st;function Ct(e){var t=new xt(e),n=$t(xt.prototype.request,t);return _t.extend(n,xt.prototype,t),_t.extend(n,t),n}var Et=Ct(et);Et.Axios=xt,Et.create=function(e){return Ct(wt(Et.defaults,e))},Et.Cancel=gt,Et.CancelToken=yt,Et.isCancel=Re,Et.all=function(e){return Promise.all(e)},Et.spread=function(e){return function(t){return e.apply(null,t)}},Et.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError},ue.exports=Et,ue.exports.default=Et;var Rt=ue.exports;const St=`${window.location.origin}/recipes`;console.log("Env:","production"),console.log("Using:",St),console.log("$$:window.location",window.location);const kt=function(){const{subscribe:e,set:t,update:n}=se(!1);return{subscribe:e,newRecipe:()=>n((e=>!0)),closeEditor:()=>n((e=>!1))}}(),At=function(){const{subscribe:e,set:t,update:n}=se({name:"",url:"",md:"",meat:"",mealtype:"",_id:"",short:"",hash:"",lastused:""});return{subscribe:e,clearItem:()=>n((e=>({name:"",url:"",md:"",meat:"",mealtype:"",_id:"",short:"",hash:"",lastused:""}))),updateItem:e=>n((t=>e))}}(),Nt=function(){const{subscribe:e,set:t,update:n}=se([]);return{subscribe:e,set:t,update:n}}(),Ot=function(){const{subscribe:e,set:t,update:n}=se({meat:"0",meal:"0"});return{subscribe:e,updateMeat:e=>n((t=>({...t,meat:e}))),updateMeal:e=>n((t=>({...t,meal:e})))}}(),Tt={newRecipe(){console.log(">> Action:newRecipe"),kt.newRecipe(),At.clearItem()},async editRecipe(e){const t=await Rt.get(`${St}/${e}`).catch((e=>{console.error(e)}));At.updateItem(t.data),kt.newRecipe()},async saveRecipe(e){console.log(">> Action:saveRecipe");const t={...e};let n;""===t.hash?(console.log("Create new"),n=await Rt.post(`${St}`,t).catch((e=>{console.error(e)}))):(console.log("Update existing"),n=await Rt.put(`${St}/${t.hash}`,t).catch((e=>{console.error(e)}))),(n.data.changes>0||"Row inserted"===n.data.msg)&&(this.closeEditor(),this.fetchRecipes())},async fetchRecipes(){console.log("$$:store:fetchRecipes:url",St);const e=await Rt.get(St);Nt.set(e.data)},closeEditor(){kt.closeEditor(),At.clearItem()},updateMeatFilter(e){Ot.updateMeat(e)},updateMealFilter(e){Ot.updateMeal(e)}};function jt(t){let n,o,r,a,i,s,u,c;return{c(){n=v("header"),o=v("h2"),o.textContent="Recipes",r=y(),a=v("ul"),i=v("li"),s=v("button"),s.textContent="New Recipe",$(s,"class","btn btn-sm"),$(s,"type","button"),$(n,"class","navbar bg-primary")},m(e,l){m(e,n,l),d(n,o),d(n,r),d(n,a),d(a,i),d(i,s),u||(c=_(s,"click",t[0]),u=!0)},p:e,i:e,o:e,d(e){e&&g(n),u=!1,c()}}}function Bt(e){return[function(){console.log("newRecipe"),Tt.newRecipe()}]}class qt extends ae{constructor(e){super(),re(this,e,Bt,jt,i,{})}}function Ft(e){const t=e-1;return t*t*t+1}function Ut(e,{delay:t=0,duration:n=400,easing:o=Ft}={}){const r=getComputedStyle(e),a=+r.opacity,i=parseFloat(r.height),s=parseFloat(r.paddingTop),u=parseFloat(r.paddingBottom),c=parseFloat(r.marginTop),l=parseFloat(r.marginBottom),f=parseFloat(r.borderTopWidth),d=parseFloat(r.borderBottomWidth);return{delay:t,duration:n,easing:o,css:e=>`overflow: hidden;opacity: ${Math.min(20*e,1)*a};height: ${e*i}px;padding-top: ${e*s}px;padding-bottom: ${e*u}px;margin-top: ${e*c}px;margin-bottom: ${e*l}px;border-top-width: ${e*f}px;border-bottom-width: ${e*d}px;`}}function Pt(e,t,n){var o,r,a,i,s;function u(){var c=Date.now()-i;c<t&&c>=0?o=setTimeout(u,t-c):(o=null,n||(s=e.apply(a,r),a=r=null))}null==t&&(t=100);var c=function(){a=this,r=arguments,i=Date.now();var c=n&&!o;return o||(o=setTimeout(u,t)),c&&(s=e.apply(a,r),a=r=null),s};return c.clear=function(){o&&(clearTimeout(o),o=null)},c.flush=function(){o&&(s=e.apply(a,r),a=r=null,clearTimeout(o),o=null)},c}Pt.debounce=Pt;var It=Pt;function Lt(e){let t,n,o,a,i,s,u,c,l,f,p,h,x,E,R,S,k,A,N,O,T,j,B,q,F,U,P,L,M,D,z,V,H,X,J,K,W,G,Q,Y,ee,te,ne,oe,re,ae,ie,se,ue,ce,le,fe;return{c(){t=v("div"),n=v("form"),o=v("label"),o.textContent="Name:",a=y(),i=v("input"),s=y(),u=v("label"),u.textContent="Url:",c=y(),l=v("input"),f=y(),p=v("label"),p.textContent="Markdown:",h=y(),x=v("textarea"),E=y(),R=v("label"),R.textContent="Meat",S=y(),k=v("select"),A=v("option"),N=v("option"),N.textContent="Chicken",O=v("option"),O.textContent="Beef",T=v("option"),T.textContent="Pork",j=v("option"),j.textContent="Fish",B=v("option"),B.textContent="Egg",q=v("option"),q.textContent="Vegetable",F=y(),U=v("label"),U.textContent="Meal type",P=y(),L=v("select"),M=v("option"),D=v("option"),D.textContent="Main",z=v("option"),z.textContent="Soup",V=v("option"),V.textContent="Note",H=y(),X=v("input"),J=y(),K=v("input"),W=y(),G=v("input"),Q=y(),Y=v("input"),ee=y(),te=v("div"),ne=v("button"),oe=b("Delete"),re=y(),ae=v("button"),ae.textContent="Close",ie=y(),se=v("button"),se.textContent="Save",$(o,"for","name"),$(i,"type","text"),$(i,"name","name"),$(i,"id","name"),i.required=!0,$(u,"for","url"),$(l,"type","text"),$(l,"name","url"),$(l,"id","url"),l.required=!0,$(p,"for","md"),$(x,"id","md"),$(x,"name","md"),$(x,"cols","50"),$(x,"rows","10"),$(R,"for","meat"),A.__value="",A.value=A.__value,N.__value="1",N.value=N.__value,O.__value="2",O.value=O.__value,T.__value="3",T.value=T.__value,j.__value="4",j.value=j.__value,B.__value="5",B.value=B.__value,q.__value="6",q.value=q.__value,$(k,"id","meat"),$(k,"name","meat"),k.required=!0,void 0===e[0].meat&&I((()=>e[9].call(k))),$(U,"for","mealtype"),M.__value="",M.value=M.__value,D.__value="1",D.value=D.__value,z.__value="2",z.value=z.__value,V.__value="128",V.value=V.__value,$(L,"id","mealtype"),$(L,"name","mealtype"),L.required=!0,void 0===e[0].mealtype&&I((()=>e[10].call(L))),$(X,"id","_id"),$(X,"name","id"),$(X,"type","hidden"),X.disabled=!0,$(K,"type","hidden"),$(K,"id","short"),$(K,"name","short"),K.disabled=!0,$(G,"type","hidden"),$(G,"id","hash"),$(G,"name","hash"),G.disabled=!0,$(Y,"type","hidden"),$(Y,"id","lastused"),$(Y,"name","lastused"),Y.disabled=!0,$(ne,"class","btn btn-danger btn-sm"),$(ne,"id","delete"),$(ne,"type","button"),ne.disabled=e[2],$(ae,"class","btn btn-sm"),$(ae,"type","button"),$(se,"class","btn btn-primary btn-sm"),$(se,"id","save"),$(se,"type","button"),$(te,"class","my text-right"),$(n,"autocomplete","off"),$(t,"class","container")},m(r,g){m(r,t,g),d(t,n),d(n,o),d(n,a),d(n,i),w(i,e[0].name),d(n,s),d(n,u),d(n,c),d(n,l),w(l,e[0].url),d(n,f),d(n,p),d(n,h),d(n,x),w(x,e[0].md),d(n,E),d(n,R),d(n,S),d(n,k),d(k,A),d(k,N),d(k,O),d(k,T),d(k,j),d(k,B),d(k,q),C(k,e[0].meat),d(n,F),d(n,U),d(n,P),d(n,L),d(L,M),d(L,D),d(L,z),d(L,V),C(L,e[0].mealtype),d(n,H),d(n,X),w(X,e[0]._id),d(n,J),d(n,K),w(K,e[0].short),d(n,W),d(n,G),w(G,e[0].hash),d(n,Q),d(n,Y),w(Y,e[0].lastused),d(n,ee),d(n,te),d(te,ne),d(ne,oe),d(te,re),d(te,ae),d(te,ie),d(te,se),ce=!0,le||(fe=[_(i,"input",e[6]),_(l,"input",e[7]),_(x,"input",e[8]),_(x,"paste",e[5]),_(k,"change",e[9]),_(L,"change",e[10]),_(X,"input",e[11]),_(K,"input",e[12]),_(G,"input",e[13]),_(Y,"input",e[14]),_(ne,"click",Dt),_(ae,"click",e[3]),_(se,"click",e[4])],le=!0)},p(e,t){1&t&&i.value!==e[0].name&&w(i,e[0].name),1&t&&l.value!==e[0].url&&w(l,e[0].url),1&t&&w(x,e[0].md),1&t&&C(k,e[0].meat),1&t&&C(L,e[0].mealtype),1&t&&w(X,e[0]._id),1&t&&w(K,e[0].short),1&t&&w(G,e[0].hash),1&t&&w(Y,e[0].lastused),(!ce||4&t)&&(ne.disabled=e[2])},i(e){ce||(I((()=>{ue||(ue=Z(t,Ut,{},!0)),ue.run(1)})),ce=!0)},o(e){ue||(ue=Z(t,Ut,{},!1)),ue.run(0),ce=!1},d(e){e&&g(t),e&&ue&&ue.end(),le=!1,r(fe)}}}function Mt(e){let t,n,o=e[1]&&Lt(e);return{c(){o&&o.c(),t=b("")},m(e,r){o&&o.m(e,r),m(e,t,r),n=!0},p(e,[n]){e[1]?o?(o.p(e,n),2&n&&G(o,1)):(o=Lt(e),o.c(),G(o,1),o.m(t.parentNode,t)):o&&(K(),Q(o,1,1,(()=>{o=null})),W())},i(e){n||(G(o),n=!0)},o(e){Q(o),n=!1},d(e){o&&o.d(e),e&&g(t)}}}function Dt(){console.log(">> DELETE")}function zt(e,t,n){let o,r,a=!1;kt.subscribe((async e=>{n(1,o=e),o&&window.scrollTo(0,0)})),At.subscribe((async e=>{n(0,r=e),n(0,r.mealtype=r.mealtype.toString(),r),n(0,r.meat=r.meat.toString(),r)}));const i=It((function(e){const t=["x","chicken","beef","pork","fish","egg","vegetable"],o={},a={};let i=0,s=0;const u=/(?:#\s)(.*)(?:\n)/.exec(e.target.value),c=/(?:\[.*]\()(.*)(?:\))/.exec(e.target.value);null!==u&&(o.name=u[1]),null!==c&&(o.url=c[1]);const l=[...e.target.value.matchAll(/([vV]egetable|[pP]ork|[cC]hicken|[bB]eef|[fF]ish|[eE]gg)/g)],f=[...e.target.value.matchAll(/([sS]oup)/g)];if(l.length>0){l.map((e=>e[0].toLowerCase())).forEach((e=>{a[e]=a[e]+1||1}));for(const e in a)a[e]>i&&(i=a[e],s=t.indexOf(e));o.meat=s.toString(10)}o.mealtype=f.length>0?"2":"1",n(0,r={...r,...o})}),250);return e.$$.update=()=>{1&e.$$.dirty&&n(2,a=""===r.hash)},[r,o,a,function(){Tt.closeEditor()},async function(){await Tt.saveRecipe(r)},function(e){i(e)},function(){r.name=this.value,n(0,r)},function(){r.url=this.value,n(0,r)},function(){r.md=this.value,n(0,r)},function(){r.meat=E(this),n(0,r)},function(){r.mealtype=E(this),n(0,r)},function(){r._id=this.value,n(0,r)},function(){r.short=this.value,n(0,r)},function(){r.hash=this.value,n(0,r)},function(){r.lastused=this.value,n(0,r)}]}class Vt extends ae{constructor(e){super(),re(this,e,zt,Mt,i,{})}}function Ht(t){let n,o,a,i,s,u,c,l,f,p,h,b,x,w,E,R,S,k;return{c(){n=v("div"),o=v("div"),a=v("select"),i=v("option"),i.textContent="All",s=v("option"),s.textContent="Chicken",u=v("option"),u.textContent="Beef",c=v("option"),c.textContent="Pork",l=v("option"),l.textContent="Fish",f=v("option"),f.textContent="Egg",p=v("option"),p.textContent="Vegetable",h=y(),b=v("select"),x=v("option"),x.textContent="All",w=v("option"),w.textContent="Mains",E=v("option"),E.textContent="Soups",R=v("option"),R.textContent="Notes",i.__value="0",i.value=i.__value,s.__value="1",s.value=s.__value,u.__value="2",u.value=u.__value,c.__value="3",c.value=c.__value,l.__value="4",l.value=l.__value,f.__value="5",f.value=f.__value,p.__value="6",p.value=p.__value,$(a,"id","meatVal"),void 0===t[0]&&I((()=>t[4].call(a))),x.__value="0",x.value=x.__value,w.__value="1",w.value=w.__value,E.__value="2",E.value=E.__value,R.__value="128",R.value=R.__value,$(b,"id","mealVal"),void 0===t[1]&&I((()=>t[5].call(b))),$(o,"class","filterBar grid-4 svelte-17lzm0a"),$(n,"class","container")},m(e,r){m(e,n,r),d(n,o),d(o,a),d(a,i),d(a,s),d(a,u),d(a,c),d(a,l),d(a,f),d(a,p),C(a,t[0]),d(o,h),d(o,b),d(b,x),d(b,w),d(b,E),d(b,R),C(b,t[1]),S||(k=[_(a,"change",t[2]),_(a,"change",t[4]),_(b,"change",t[3]),_(b,"change",t[5])],S=!0)},p(e,[t]){1&t&&C(a,e[0]),2&t&&C(b,e[1])},i:e,o:e,d(e){e&&g(n),S=!1,r(k)}}}function Xt(e,t,n){let o="0",r="0";const a=["","1","2","128"];return T((()=>{setTimeout((()=>{const e=document.getElementById("meatVal").selectedIndex,t=document.getElementById("mealVal").selectedIndex;0!==e&&(n(0,o=e.toString(10)),Tt.updateMeatFilter(o)),0!==t&&(n(1,r=a[t]),Tt.updateMealFilter(r))}),25)})),[o,r,function(e){const t=e.target.value;Tt.updateMeatFilter(t)},function(e){const t=e.target.value;Tt.updateMealFilter(t)},function(){o=E(this),n(0,o)},function(){r=E(this),n(1,r)}]}class Jt extends ae{constructor(e){super(),re(this,e,Xt,Ht,i,{})}}function Kt(e){let t;return{c(){t=v("span"),t.textContent="Note",$(t,"class","badge badge-dark")},m(e,n){m(e,t,n)},d(e){e&&g(t)}}}function Wt(e){let t;return{c(){t=v("span"),t.textContent="Soup",$(t,"class","badge badge-light")},m(e,n){m(e,t,n)},d(e){e&&g(t)}}}function Gt(t){let n,o,r,i,s,u,c,l,f,p,h,w,C,E,R,S=t[0].name+"";function k(e,t){return 2===e[0].mealtype?Wt:128===e[0].mealtype?Kt:void 0}let A=k(t),N=A&&A(t);return{c(){n=v("div"),o=v("div"),r=v("a"),i=b(S),s=y(),u=v("div"),N&&N.c(),c=y(),l=v("span"),f=b(t[2]),h=y(),w=v("div"),C=v("button"),C.textContent="Edit",$(r,"href",t[3]),$(o,"class","listItemSix svelte-qibu9a"),$(l,"class",p="badge "+t[1]+" svelte-qibu9a"),$(u,"class","listItemThree svelte-qibu9a"),$(C,"class","btn btn-primary btn-sm"),$(C,"type","button"),$(w,"class","listItemThree all-center svelte-qibu9a"),$(n,"class","recipeItem svelte-qibu9a")},m(e,p){m(e,n,p),d(n,o),d(o,r),d(r,i),d(n,s),d(n,u),N&&N.m(u,null),d(u,c),d(u,l),d(l,f),d(n,h),d(n,w),d(w,C),E||(R=_(C,"click",(function(){a(t[4](t[0].hash))&&t[4](t[0].hash).apply(this,arguments)})),E=!0)},p(e,[n]){t=e,1&n&&S!==(S=t[0].name+"")&&x(i,S),8&n&&$(r,"href",t[3]),A!==(A=k(t))&&(N&&N.d(1),N=A&&A(t),N&&(N.c(),N.m(u,c))),4&n&&x(f,t[2]),2&n&&p!==(p="badge "+t[1]+" svelte-qibu9a")&&$(l,"class",p)},i:e,o:e,d(e){e&&g(n),N&&N.d(),E=!1,R()}}}function Qt(e,t,n){let o,r,a,{recipeItem:i={}}=t;const s=["x","Chicken","Beef","Pork","Fish","Egg","Vegetable"];return e.$$set=e=>{"recipeItem"in e&&n(0,i=e.recipeItem)},e.$$.update=()=>{1&e.$$.dirty&&(n(2,r=s[i.meat]),n(1,o=""===i.meat?"":s[i.meat].toLowerCase()),n(3,a=`/view/${i.short}`))},[i,o,r,a,function(e){Tt.editRecipe(e)}]}class Yt extends ae{constructor(e){super(),re(this,e,Qt,Gt,i,{recipeItem:0})}}function Zt(e,t,n){const o=e.slice();return o[4]=t[n],o}function en(e){let t,n;return t=new Yt({props:{recipeItem:e[4]}}),{c(){ee(t.$$.fragment)},m(e,o){te(t,e,o),n=!0},p(e,n){const o={};1&n&&(o.recipeItem=e[4]),t.$set(o)},i(e){n||(G(t.$$.fragment,e),n=!0)},o(e){Q(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function tn(e){let t,n,o=e[0],r=[];for(let t=0;t<o.length;t+=1)r[t]=en(Zt(e,o,t));const a=e=>Q(r[e],1,1,(()=>{r[e]=null}));return{c(){t=v("div");for(let e=0;e<r.length;e+=1)r[e].c();$(t,"class","container ")},m(e,o){m(e,t,o);for(let e=0;e<r.length;e+=1)r[e].m(t,null);n=!0},p(e,[n]){if(1&n){let i;for(o=e[0],i=0;i<o.length;i+=1){const a=Zt(e,o,i);r[i]?(r[i].p(a,n),G(r[i],1)):(r[i]=en(a),r[i].c(),G(r[i],1),r[i].m(t,null))}for(K(),i=o.length;i<r.length;i+=1)a(i);W()}},i(e){if(!n){for(let e=0;e<o.length;e+=1)G(r[e]);n=!0}},o(e){r=r.filter(Boolean);for(let e=0;e<r.length;e+=1)Q(r[e]);n=!1},d(e){e&&g(t),function(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}(r,e)}}}function nn(e,t,n){let o=[],r=[],a={meat:"0",meal:"0"};function i(e){console.log("$$:doFilter",e);const t=parseInt(a.meat,10),n=parseInt(a.meal,10);return e.filter((e=>0===n||e.mealtype===n)).filter((e=>0===t||e.meat===t)).sort(((e,t)=>{var n=e.short,o=t.short;return n<o?-1:n>o?1:0}))}return Nt.subscribe((async e=>{console.log("$$:ecipes.subscribe",e),o=e,n(0,r=i(o))})),Ot.subscribe((async e=>{console.log("$$:filter.subscribe",e),a=e,n(0,r=i(o))})),T((async()=>{console.log("$$:recipes:onMount"),await Tt.fetchRecipes()})),[r]}class on extends ae{constructor(e){super(),re(this,e,nn,tn,i,{})}}function rn(t){let n,o,r,a,i,s,u,c,l;return o=new qt({}),a=new Vt({}),s=new Jt({}),c=new on({}),{c(){n=v("main"),ee(o.$$.fragment),r=y(),ee(a.$$.fragment),i=y(),ee(s.$$.fragment),u=y(),ee(c.$$.fragment)},m(e,t){m(e,n,t),te(o,n,null),d(n,r),te(a,n,null),d(n,i),te(s,n,null),d(n,u),te(c,n,null),l=!0},p:e,i(e){l||(G(o.$$.fragment,e),G(a.$$.fragment,e),G(s.$$.fragment,e),G(c.$$.fragment,e),l=!0)},o(e){Q(o.$$.fragment,e),Q(a.$$.fragment,e),Q(s.$$.fragment,e),Q(c.$$.fragment,e),l=!1},d(e){e&&g(n),ne(o),ne(a),ne(s),ne(c)}}}return new class extends ae{constructor(e){super(),re(this,e,null,rn,i,{})}}({target:document.body,props:{}})}();
//# sourceMappingURL=bundle.js.map