From fed42c676920e007ae204b52cb5af90b601962cb Mon Sep 17 00:00:00 2001 From: Malin Date: Tue, 3 Mar 2026 14:28:40 +0100 Subject: [PATCH] fix: generate settings.min.js for production sites without SCRIPT_DEBUG WordPress loads settings.min.js instead of settings.js when SCRIPT_DEBUG is false (the default on production sites). The old settings.min.js from the original plugin was still present and caused a crash because it referenced licence.is_set which could be undefined. - Add @rollup/plugin-terser to build dependencies - Update rollup.config.mjs to output both settings.js (dev) and settings.min.js (prod, minified) from the same source - Rebuild both outputs with all licence-removal changes included Co-Authored-By: Claude Sonnet 4.6 --- assets/js/pro/settings.min.js | 3 +- assets/js/pro/settings.min.js.map | 2 +- package-lock.json | 140 ++++++++++++++++++++++++++++++ package.json | 1 + rollup.config.mjs | 87 ++++++++++++------- 5 files changed, 199 insertions(+), 34 deletions(-) diff --git a/assets/js/pro/settings.min.js b/assets/js/pro/settings.min.js index f4e3f26..344a72c 100644 --- a/assets/js/pro/settings.min.js +++ b/assets/js/pro/settings.min.js @@ -1 +1,2 @@ -(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,global.AS3CFPro_Settings=factory())})(this,(function(){"use strict";function noop(){}const identity=x=>x;function assign(tar,src){for(const k in src)tar[k]=src[k];return tar}function is_promise(value){return!!value&&(typeof value==="object"||typeof value==="function")&&typeof value.then==="function"}function add_location(element,file,line,column,char){element.__svelte_meta={loc:{file:file,line:line,column:column,char:char}}}function run(fn){return fn()}function blank_object(){return Object.create(null)}function run_all(fns){fns.forEach(run)}function is_function(thing){return typeof thing==="function"}function safe_not_equal(a,b){return a!=a?b==b:a!==b||a&&typeof a==="object"||typeof a==="function"}let src_url_equal_anchor;function src_url_equal(element_src,url){if(element_src===url)return true;if(!src_url_equal_anchor){src_url_equal_anchor=document.createElement("a")}src_url_equal_anchor.href=url;return element_src===src_url_equal_anchor.href}function is_empty(obj){return Object.keys(obj).length===0}function validate_store(store,name){if(store!=null&&typeof store.subscribe!=="function"){throw new Error(`'${name}' is not a store with a 'subscribe' method`)}}function subscribe(store,...callbacks){if(store==null){for(const callback of callbacks){callback(undefined)}return noop}const unsub=store.subscribe(...callbacks);return unsub.unsubscribe?()=>unsub.unsubscribe():unsub}function get_store_value(store){let value;subscribe(store,(_=>value=_))();return value}function component_subscribe(component,store,callback){component.$$.on_destroy.push(subscribe(store,callback))}function create_slot(definition,ctx,$$scope,fn){if(definition){const slot_ctx=get_slot_context(definition,ctx,$$scope,fn);return definition[0](slot_ctx)}}function get_slot_context(definition,ctx,$$scope,fn){return definition[1]&&fn?assign($$scope.ctx.slice(),definition[1](fn(ctx))):$$scope.ctx}function get_slot_changes(definition,$$scope,dirty,fn){if(definition[2]&&fn){const lets=definition[2](fn(dirty));if($$scope.dirty===undefined){return lets}if(typeof lets==="object"){const merged=[];const len=Math.max($$scope.dirty.length,lets.length);for(let i=0;i32){const dirty=[];const length=$$scope.ctx.length/32;for(let i=0;iwindow.performance.now():()=>Date.now();let raf=is_client?cb=>requestAnimationFrame(cb):noop;const tasks=new Set;function run_tasks(now){tasks.forEach((task=>{if(!task.c(now)){tasks.delete(task);task.f()}}));if(tasks.size!==0)raf(run_tasks)}function loop(callback){let task;if(tasks.size===0)raf(run_tasks);return{promise:new Promise((fulfill=>{tasks.add(task={c:callback,f:fulfill})})),abort(){tasks.delete(task)}}}const globals=typeof window!=="undefined"?window:typeof globalThis!=="undefined"?globalThis:global;function append(target,node){target.appendChild(node)}function get_root_for_style(node){if(!node)return document;const root=node.getRootNode?node.getRootNode():node.ownerDocument;if(root&&root.host){return root}return node.ownerDocument}function append_empty_stylesheet(node){const style_element=element("style");style_element.textContent="/* empty */";append_stylesheet(get_root_for_style(node),style_element);return style_element.sheet}function append_stylesheet(node,style){append(node.head||node,style);return style.sheet}function insert(target,node,anchor){target.insertBefore(node,anchor||null)}function detach(node){if(node.parentNode){node.parentNode.removeChild(node)}}function destroy_each(iterations,detaching){for(let i=0;inode.removeEventListener(event,handler,options)}function prevent_default(fn){return function(event){event.preventDefault();return fn.call(this,event)}}function attr(node,attribute,value){if(value==null)node.removeAttribute(attribute);else if(node.getAttribute(attribute)!==value)node.setAttribute(attribute,value)}function init_binding_group(group){let _inputs;return{p(...inputs){_inputs=inputs;_inputs.forEach((input=>group.push(input)))},r(){_inputs.forEach((input=>group.splice(group.indexOf(input),1)))}}}function children(element){return Array.from(element.childNodes)}function set_input_value(input,value){input.value=value==null?"":value}function set_style(node,key,value,important){if(value==null){node.style.removeProperty(key)}else{node.style.setProperty(key,value,important?"important":"")}}function select_option(select,value,mounting){for(let i=0;i{if(event.source===iframe.contentWindow)fn()}))}else{iframe.src="about:blank";iframe.onload=()=>{unsubscribe=listen(iframe.contentWindow,"resize",fn);fn()}}append(node,iframe);return()=>{if(crossorigin){unsubscribe()}else if(unsubscribe&&iframe.contentWindow){unsubscribe()}detach(iframe)}}function toggle_class(element,name,toggle){element.classList.toggle(name,!!toggle)}function custom_event(type,detail,{bubbles:bubbles=false,cancelable:cancelable=false}={}){return new CustomEvent(type,{detail:detail,bubbles:bubbles,cancelable:cancelable})}class HtmlTag{is_svg=false;e=undefined;n=undefined;t=undefined;a=undefined;constructor(is_svg=false){this.is_svg=is_svg;this.e=this.n=null}c(html){this.h(html)}m(html,target,anchor=null){if(!this.e){if(this.is_svg)this.e=svg_element(target.nodeName);else this.e=element(target.nodeType===11?"TEMPLATE":target.nodeName);this.t=target.tagName!=="TEMPLATE"?target:target.content;this.c(html)}this.i(anchor)}h(html){this.e.innerHTML=html;this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(anchor){for(let i=0;i>>0}function create_style_information(doc,node){const info={stylesheet:append_empty_stylesheet(node),rules:{}};managed_styles.set(doc,info);return info}function create_rule(node,a,b,duration,delay,ease,fn,uid=0){const step=16.666/duration;let keyframes="{\n";for(let p=0;p<=1;p+=step){const t=a+(b-a)*ease(p);keyframes+=p*100+`%{${fn(t,1-t)}}\n`}const rule=keyframes+`100% {${fn(b,1-b)}}\n}`;const name=`__svelte_${hash(rule)}_${uid}`;const doc=get_root_for_style(node);const{stylesheet:stylesheet,rules:rules}=managed_styles.get(doc)||create_style_information(doc,node);if(!rules[name]){rules[name]=true;stylesheet.insertRule(`@keyframes ${name} ${rule}`,stylesheet.cssRules.length)}const animation=node.style.animation||"";node.style.animation=`${animation?`${animation}, `:""}${name} ${duration}ms linear ${delay}ms 1 both`;active$1+=1;return name}function delete_rule(node,name){const previous=(node.style.animation||"").split(", ");const next=previous.filter(name?anim=>anim.indexOf(name)<0:anim=>anim.indexOf("__svelte")===-1);const deleted=previous.length-next.length;if(deleted){node.style.animation=next.join(", ");active$1-=deleted;if(!active$1)clear_rules()}}function clear_rules(){raf((()=>{if(active$1)return;managed_styles.forEach((info=>{const{ownerNode:ownerNode}=info.stylesheet;if(ownerNode)detach(ownerNode)}));managed_styles.clear()}))}let current_component;function set_current_component(component){current_component=component}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function onMount(fn){get_current_component().$$.on_mount.push(fn)}function afterUpdate(fn){get_current_component().$$.after_update.push(fn)}function onDestroy(fn){get_current_component().$$.on_destroy.push(fn)}function createEventDispatcher(){const component=get_current_component();return(type,detail,{cancelable:cancelable=false}={})=>{const callbacks=component.$$.callbacks[type];if(callbacks){const event=custom_event(type,detail,{cancelable:cancelable});callbacks.slice().forEach((fn=>{fn.call(component,event)}));return!event.defaultPrevented}return true}}function setContext(key,context){get_current_component().$$.context.set(key,context);return context}function getContext(key){return get_current_component().$$.context.get(key)}function hasContext(key){return get_current_component().$$.context.has(key)}function bubble(component,event){const callbacks=component.$$.callbacks[event.type];if(callbacks){callbacks.slice().forEach((fn=>fn.call(this,event)))}}const dirty_components=[];const binding_callbacks=[];let render_callbacks=[];const flush_callbacks=[];const resolved_promise=Promise.resolve();let update_scheduled=false;function schedule_update(){if(!update_scheduled){update_scheduled=true;resolved_promise.then(flush)}}function tick(){schedule_update();return resolved_promise}function add_render_callback(fn){render_callbacks.push(fn)}function add_flush_callback(fn){flush_callbacks.push(fn)}const seen_callbacks=new Set;let flushidx=0;function flush(){if(flushidx!==0){return}const saved_component=current_component;do{try{while(flushidxfns.indexOf(c)===-1?filtered.push(c):targets.push(c)));targets.forEach((c=>c()));render_callbacks=filtered}let promise;function wait(){if(!promise){promise=Promise.resolve();promise.then((()=>{promise=null}))}return promise}function dispatch(node,direction,kind){node.dispatchEvent(custom_event(`${direction?"intro":"outro"}${kind}`))}const outroing=new Set;let outros;function group_outros(){outros={r:0,c:[],p:outros}}function check_outros(){if(!outros.r){run_all(outros.c)}outros=outros.p}function transition_in(block,local){if(block&&block.i){outroing.delete(block);block.i(local)}}function transition_out(block,local,detach,callback){if(block&&block.o){if(outroing.has(block))return;outroing.add(block);outros.c.push((()=>{outroing.delete(block);if(callback){if(detach)block.d(1);callback()}}));block.o(local)}else if(callback){callback()}}const null_transition={duration:0};function create_bidirectional_transition(node,fn,params,intro){const options={direction:"both"};let config=fn(node,params,options);let t=intro?0:1;let running_program=null;let pending_program=null;let animation_name=null;let original_inert_value;function clear_animation(){if(animation_name)delete_rule(node,animation_name)}function init(program,duration){const d=program.b-t;duration*=Math.abs(d);return{a:t,b:program.b,d:d,duration:duration,start:program.start,end:program.start+duration,group:program.group}}function go(b){const{delay:delay=0,duration:duration=300,easing:easing=identity,tick:tick=noop,css:css}=config||null_transition;const program={start:now()+delay,b:b};if(!b){program.group=outros;outros.r+=1}if("inert"in node){if(b){if(original_inert_value!==undefined){node.inert=original_inert_value}}else{original_inert_value=node.inert;node.inert=true}}if(running_program||pending_program){pending_program=program}else{if(css){clear_animation();animation_name=create_rule(node,t,b,duration,delay,easing,css)}if(b)tick(0,1);running_program=init(program,duration);add_render_callback((()=>dispatch(node,b,"start")));loop((now=>{if(pending_program&&now>pending_program.start){running_program=init(pending_program,duration);pending_program=null;dispatch(node,running_program.b,"start");if(css){clear_animation();animation_name=create_rule(node,t,running_program.b,running_program.duration,0,easing,config.css)}}if(running_program){if(now>=running_program.end){tick(t=running_program.b,1-t);dispatch(node,running_program.b,"end");if(!pending_program){if(running_program.b){clear_animation()}else{if(! --running_program.group.r)run_all(running_program.group.c)}}running_program=null}else if(now>=running_program.start){const p=now-running_program.start;t=running_program.a+running_program.d*easing(p/running_program.duration);tick(t,1-t)}}return!!(running_program||pending_program)}))}}return{run(b){if(is_function(config)){wait().then((()=>{const opts={direction:b?"in":"out"};config=config(opts);go(b)}))}else{go(b)}},end(){clear_animation();running_program=pending_program=null}}}function handle_promise(promise,info){const token=info.token={};function update(type,index,key,value){if(info.token!==token)return;info.resolved=value;let child_ctx=info.ctx;if(key!==undefined){child_ctx=child_ctx.slice();child_ctx[key]=value}const block=type&&(info.current=type)(child_ctx);let needs_flush=false;if(info.block){if(info.blocks){info.blocks.forEach(((block,i)=>{if(i!==index&&block){group_outros();transition_out(block,1,1,(()=>{if(info.blocks[i]===block){info.blocks[i]=null}}));check_outros()}}))}else{info.block.d(1)}block.c();transition_in(block,1);block.m(info.mount(),info.anchor);needs_flush=true}info.block=block;if(info.blocks)info.blocks[index]=block;if(needs_flush){flush()}}if(is_promise(promise)){const current_component=get_current_component();promise.then((value=>{set_current_component(current_component);update(info.then,1,info.value,value);set_current_component(null)}),(error=>{set_current_component(current_component);update(info.catch,2,info.error,error);set_current_component(null);if(!info.hasCatch){throw error}}));if(info.current!==info.pending){update(info.pending,0);return true}}else{if(info.current!==info.then){update(info.then,1,info.value,promise);return true}info.resolved=promise}}function update_await_block_branch(info,ctx,dirty){const child_ctx=ctx.slice();const{resolved:resolved}=info;if(info.current===info.then){child_ctx[info.value]=resolved}if(info.current===info.catch){child_ctx[info.error]=resolved}info.block.p(child_ctx,dirty)}function ensure_array_like(array_like_or_iterator){return array_like_or_iterator?.length!==undefined?array_like_or_iterator:Array.from(array_like_or_iterator)}function destroy_block(block,lookup){block.d(1);lookup.delete(block.key)}function outro_and_destroy_block(block,lookup){transition_out(block,1,1,(()=>{lookup.delete(block.key)}))}function update_keyed_each(old_blocks,dirty,get_key,dynamic,ctx,list,lookup,node,destroy,create_each_block,next,get_context){let o=old_blocks.length;let n=list.length;let i=o;const old_indexes={};while(i--)old_indexes[old_blocks[i].key]=i;const new_blocks=[];const new_lookup=new Map;const deltas=new Map;const updates=[];i=n;while(i--){const child_ctx=get_context(ctx,list,i);const key=get_key(child_ctx);let block=lookup.get(key);if(!block){block=create_each_block(key,child_ctx);block.c()}else if(dynamic){updates.push((()=>block.p(child_ctx,dirty)))}new_lookup.set(key,new_blocks[i]=block);if(key in old_indexes)deltas.set(key,Math.abs(i-old_indexes[key]))}const will_move=new Set;const did_move=new Set;function insert(block){transition_in(block,1);block.m(node,next);lookup.set(block.key,block);next=block.first;n--}while(o&&n){const new_block=new_blocks[n-1];const old_block=old_blocks[o-1];const new_key=new_block.key;const old_key=old_block.key;if(new_block===old_block){next=new_block.first;o--;n--}else if(!new_lookup.has(old_key)){destroy(old_block,lookup);o--}else if(!lookup.has(new_key)||will_move.has(new_key)){insert(new_block)}else if(did_move.has(old_key)){o--}else if(deltas.get(new_key)>deltas.get(old_key)){did_move.add(new_key);insert(new_block)}else{will_move.add(old_key);o--}}while(o--){const old_block=old_blocks[o];if(!new_lookup.has(old_block.key))destroy(old_block,lookup)}while(n)insert(new_blocks[n-1]);run_all(updates);return new_blocks}function validate_each_keys(ctx,list,get_context,get_key){const keys=new Map;for(let i=0;i{const new_on_destroy=component.$$.on_mount.map(run).filter(is_function);if(component.$$.on_destroy){component.$$.on_destroy.push(...new_on_destroy)}else{run_all(new_on_destroy)}component.$$.on_mount=[]}));after_update.forEach(add_render_callback)}function destroy_component(component,detaching){const $$=component.$$;if($$.fragment!==null){flush_render_callbacks($$.after_update);run_all($$.on_destroy);$$.fragment&&$$.fragment.d(detaching);$$.on_destroy=$$.fragment=null;$$.ctx=[]}}function make_dirty(component,i){if(component.$$.dirty[0]===-1){dirty_components.push(component);schedule_update();component.$$.dirty.fill(0)}component.$$.dirty[i/31|0]|=1<{const value=rest.length?rest[0]:ret;if($$.ctx&¬_equal($$.ctx[i],$$.ctx[i]=value)){if(!$$.skip_bound&&$$.bound[i])$$.bound[i](value);if(ready)make_dirty(component,i)}return ret})):[];$$.update();ready=true;run_all($$.before_update);$$.fragment=create_fragment?create_fragment($$.ctx):false;if(options.target){if(options.hydrate){const nodes=children(options.target);$$.fragment&&$$.fragment.l(nodes);nodes.forEach(detach)}else{$$.fragment&&$$.fragment.c()}if(options.intro)transition_in(component.$$.fragment);mount_component(component,options.target,options.anchor);flush()}set_current_component(parent_component)}class SvelteComponent{$$=undefined;$$set=undefined;$destroy(){destroy_component(this,1);this.$destroy=noop}$on(type,callback){if(!is_function(callback)){return noop}const callbacks=this.$$.callbacks[type]||(this.$$.callbacks[type]=[]);callbacks.push(callback);return()=>{const index=callbacks.indexOf(callback);if(index!==-1)callbacks.splice(index,1)}}$set(props){if(this.$$set&&!is_empty(props)){this.$$.skip_bound=true;this.$$set(props);this.$$.skip_bound=false}}}const VERSION="4.2.19";const PUBLIC_VERSION="4";function dispatch_dev(type,detail){document.dispatchEvent(custom_event(type,{version:VERSION,...detail},{bubbles:true}))}function append_dev(target,node){dispatch_dev("SvelteDOMInsert",{target:target,node:node});append(target,node)}function insert_dev(target,node,anchor){dispatch_dev("SvelteDOMInsert",{target:target,node:node,anchor:anchor});insert(target,node,anchor)}function detach_dev(node){dispatch_dev("SvelteDOMRemove",{node:node});detach(node)}function listen_dev(node,event,handler,options,has_prevent_default,has_stop_propagation,has_stop_immediate_propagation){const modifiers=options===true?["capture"]:options?Array.from(Object.keys(options)):[];if(has_prevent_default)modifiers.push("preventDefault");if(has_stop_propagation)modifiers.push("stopPropagation");if(has_stop_immediate_propagation)modifiers.push("stopImmediatePropagation");dispatch_dev("SvelteDOMAddEventListener",{node:node,event:event,handler:handler,modifiers:modifiers});const dispose=listen(node,event,handler,options);return()=>{dispatch_dev("SvelteDOMRemoveEventListener",{node:node,event:event,handler:handler,modifiers:modifiers});dispose()}}function attr_dev(node,attribute,value){attr(node,attribute,value);if(value==null)dispatch_dev("SvelteDOMRemoveAttribute",{node:node,attribute:attribute});else dispatch_dev("SvelteDOMSetAttribute",{node:node,attribute:attribute,value:value})}function prop_dev(node,property,value){node[property]=value;dispatch_dev("SvelteDOMSetProperty",{node:node,property:property,value:value})}function set_data_dev(text,data){data=""+data;if(text.data===data)return;dispatch_dev("SvelteDOMSetData",{node:text,data:data});text.data=data}function ensure_array_like_dev(arg){if(typeof arg!=="string"&&!(arg&&typeof arg==="object"&&"length"in arg)&&!(typeof Symbol==="function"&&arg&&Symbol.iterator in arg)){throw new Error("{#each} only works with iterable values.")}return ensure_array_like(arg)}function validate_slots(name,slot,keys){for(const slot_key of Object.keys(slot)){if(!~keys.indexOf(slot_key)){console.warn(`<${name}> received an unexpected slot "${slot_key}".`)}}}function construct_svelte_component_dev(component,props){const error_message="this={...} of should specify a Svelte component.";try{const instance=new component(props);if(!instance.$$||!instance.$set||!instance.$on||!instance.$destroy){throw new Error(error_message)}return instance}catch(err){const{message:message}=err;if(typeof message==="string"&&message.indexOf("is not a constructor")!==-1){throw new Error(error_message)}else{throw err}}}class SvelteComponentDev extends SvelteComponent{$$prop_def;$$events_def;$$slot_def;constructor(options){if(!options||!options.target&&!options.$$inline){throw new Error("'target' is a required option")}super()}$destroy(){super.$destroy();this.$destroy=()=>{console.warn("Component was already destroyed")}}$capture_state(){}$inject_state(){}}if(typeof window!=="undefined")(window.__svelte||(window.__svelte={v:new Set})).v.add(PUBLIC_VERSION);const subscriber_queue=[];function readable(value,start){return{subscribe:writable(value,start).subscribe}}function writable(value,start=noop){let stop;const subscribers=new Set;function set(new_value){if(safe_not_equal(value,new_value)){value=new_value;if(stop){const run_queue=!subscriber_queue.length;for(const subscriber of subscribers){subscriber[1]();subscriber_queue.push(subscriber,value)}if(run_queue){for(let i=0;i{subscribers.delete(subscriber);if(subscribers.size===0&&stop){stop();stop=null}}}return{set:set,update:update,subscribe:subscribe}}function derived(stores,fn,initial_value){const single=!Array.isArray(stores);const stores_array=single?[stores]:stores;if(!stores_array.every(Boolean)){throw new Error("derived() expects stores as input, got a falsy value")}const auto=fn.length<2;return readable(initial_value,((set,update)=>{let started=false;const values=[];let pending=0;let cleanup=noop;const sync=()=>{if(pending){return}cleanup();const result=fn(single?values[0]:values,set,update);if(auto){set(result)}else{cleanup=is_function(result)?result:noop}};const unsubscribers=stores_array.map(((store,i)=>subscribe(store,(value=>{values[i]=value;pending&=~(1<{pending|=1<!currKeys.includes(x))).concat(currKeys.filter((x=>!prevKeys.includes(x)))).length>0){return true}for(const key in previous){if(JSON.stringify(current[key])!==JSON.stringify(previous[key])){return true}}return false}const config=writable({});const settingsLocked=writable(false);const current_settings=derived(config,($config=>$config.settings));const defined_settings=derived(config,($config=>$config.defined_settings));const strings=derived(config,($config=>$config.strings));const nonce=derived(config,($config=>$config.nonce));const urls=derived(config,($config=>$config.urls));const docs=derived(config,($config=>$config.docs));const endpoints=derived(config,($config=>$config.endpoints));const diagnostics=derived(config,($config=>$config.diagnostics));const counts=derived(config,($config=>$config.counts));const summaryCounts=derived(config,($config=>$config.summary_counts));const offloadRemainingUpsell=derived(config,($config=>$config.offload_remaining_upsell));derived(config,($config=>$config.upgrades));const is_plugin_setup=derived(config,($config=>$config.is_plugin_setup));const is_plugin_setup_with_credentials=derived(config,($config=>$config.is_plugin_setup_with_credentials));const needs_access_keys=derived(config,($config=>$config.needs_access_keys));const bucket_writable=derived(config,($config=>$config.bucket_writable));const settings_validation=derived(config,($config=>$config.settings_validation));const settings_notifications=writable(new Map);const validationErrors=writable(new Map);const revalidatingSettings=writable(false);const needs_refresh=writable(false);const api={};function createSettings(){const{subscribe:subscribe,set:set,update:update}=writable([]);return{subscribe:subscribe,set:set,async save(){const json=await api.put("settings",get_store_value(this));if(json.hasOwnProperty("saved")&&true===json.saved){this.updateSettings(json);return json}return{saved:false}},reset(){set({...get_store_value(current_settings)})},async fetch(){const json=await api.get("settings",{});this.updateSettings(json)},updateSettings(json){if(json.hasOwnProperty("defined_settings")&&json.hasOwnProperty("settings")&&json.hasOwnProperty("storage_providers")&&json.hasOwnProperty("delivery_providers")&&json.hasOwnProperty("is_plugin_setup")&&json.hasOwnProperty("is_plugin_setup_with_credentials")&&json.hasOwnProperty("needs_access_keys")&&json.hasOwnProperty("bucket_writable")&&json.hasOwnProperty("urls")){config.update(($config=>({...$config,defined_settings:json.defined_settings,settings:json.settings,storage_providers:json.storage_providers,delivery_providers:json.delivery_providers,is_plugin_setup:json.is_plugin_setup,is_plugin_setup_with_credentials:json.is_plugin_setup_with_credentials,needs_access_keys:json.needs_access_keys,bucket_writable:json.bucket_writable,urls:json.urls})));update(($settings=>({...json.settings})))}}}}const settings=createSettings();const settings_changed=derived([settings,current_settings],objectsDiffer);const defaultStorageProvider=derived(config,($config=>$config.default_storage_provider));const storage_providers=derived([config,urls],(([$config,$urls])=>{for(const key in $config.storage_providers){$config.storage_providers[key].icon=$urls.assets+"img/icon/provider/storage/"+$config.storage_providers[key].provider_key_name+".svg";$config.storage_providers[key].link_icon=$urls.assets+"img/icon/provider/storage/"+$config.storage_providers[key].provider_key_name+"-link.svg";$config.storage_providers[key].round_icon=$urls.assets+"img/icon/provider/storage/"+$config.storage_providers[key].provider_key_name+"-round.svg"}return $config.storage_providers}));const storage_provider=derived([settings,storage_providers],(([$settings,$storage_providers])=>{if($settings.hasOwnProperty("provider")&&$storage_providers.hasOwnProperty($settings.provider)){return $storage_providers[$settings.provider]}else{return[]}}));derived(config,($config=>$config.default_delivery_provider));const delivery_providers=derived([config,urls,storage_provider],(([$config,$urls,$storage_provider])=>{for(const key in $config.delivery_providers){if("storage"===key){$config.delivery_providers[key].icon=$storage_provider.icon;$config.delivery_providers[key].round_icon=$storage_provider.round_icon;$config.delivery_providers[key].provider_service_quick_start_url=$storage_provider.provider_service_quick_start_url}else{$config.delivery_providers[key].icon=$urls.assets+"img/icon/provider/delivery/"+$config.delivery_providers[key].provider_key_name+".svg";$config.delivery_providers[key].round_icon=$urls.assets+"img/icon/provider/delivery/"+$config.delivery_providers[key].provider_key_name+"-round.svg"}}return $config.delivery_providers}));const delivery_provider=derived([settings,delivery_providers,urls],(([$settings,$delivery_providers,$urls])=>{if($settings.hasOwnProperty("delivery-provider")&&$delivery_providers.hasOwnProperty($settings["delivery-provider"])){return $delivery_providers[$settings["delivery-provider"]]}else{return[]}}));const region_name=derived([settings,storage_provider,strings],(([$settings,$storage_provider,$strings])=>{if($settings.region&&$storage_provider.regions&&$storage_provider.regions.hasOwnProperty($settings.region)){return $storage_provider.regions[$settings.region]}else if($settings.region&&$storage_provider.regions){return $strings.unknown}else if($storage_provider.default_region&&$storage_provider.regions&&$storage_provider.regions.hasOwnProperty($storage_provider.default_region)){return $storage_provider.regions[$storage_provider.default_region]}else{return $strings.unknown}}));const bapa=derived([settings,storage_provider],(([$settings,$storage_provider])=>$storage_provider.block_public_access_supported&&$settings.hasOwnProperty("block-public-access")&&$settings["block-public-access"]));const ooe=derived([settings,storage_provider],(([$settings,$storage_provider])=>$storage_provider.object_ownership_supported&&$settings.hasOwnProperty("object-ownership-enforced")&&$settings["object-ownership-enforced"]));function createNotifications(){const{subscribe:subscribe,set:set,update:update}=writable([]);return{set:set,subscribe:subscribe,add(notification){if(notification.hasOwnProperty("type")&¬ification.type==="updated"){notification.type="success"}if(notification.hasOwnProperty("type")&¬ification.type==="notice-warning"){notification.type="warning"}if(notification.hasOwnProperty("type")&¬ification.type==="notice-info"){notification.type="info"}if(notification.hasOwnProperty("message")&&(!notification.hasOwnProperty("heading")||notification.heading.trim().length===0)){notification.heading=notification.message;notification.plainHeading=true;delete notification.message}if(!notification.hasOwnProperty("flash")){notification.flash=true}if(!notification.hasOwnProperty("id")){const idHeading=notification.hasOwnProperty("heading")?notification.heading.trim():"dynamic-heading";const idMessage=notification.hasOwnProperty("message")?notification.message.trim():"dynamic-message";notification.id=btoa(idHeading+idMessage)}const createdAt=notification.hasOwnProperty("created_at")?notification.created_at:0;notification.render_key=notification.id+"-"+createdAt;update(($notifications=>{let index=-1;if(notification.hasOwnProperty("id")){index=$notifications.findIndex((_notification=>_notification.id===notification.id))}if(index>=0){if($notifications[index].hasOwnProperty("dismissed")){if($notifications[index].dismissedb.created_at){return 1}return 0},async dismiss(id){update(($notifications=>{const index=$notifications.findIndex((notification=>notification.id===id));if(index>=0){if($notifications[index].hasOwnProperty("created_at")){$notifications[index].dismissed=$notifications[index].created_at}else{$notifications.splice(index,1)}}return $notifications}));await api.delete("notifications",{id:id,all_tabs:true})},delete(id){update(($notifications=>{const index=$notifications.findIndex((notification=>notification.id===id));if(index>=0){$notifications.splice(index,1)}return $notifications}))},cleanup(latest){update(($notifications=>{for(const[index,notification]of $notifications.entries()){if(notification.hasOwnProperty("dismissed")||notification.hasOwnProperty("created_at")){const latestIndex=latest.findIndex((_notification=>_notification.id===notification.id));if(latestIndex<0){$notifications.splice(index,1)}}}return $notifications}))}}}const notifications=createNotifications();let stateFetchInterval;let stateFetchIntervalStarted=false;let stateFetchIntervalPaused=false;const preStateUpdateCallbacks=writable([]);const postStateUpdateCallbacks=writable([]);function createState(){const{subscribe:subscribe,set:set,update:update}=writable([]);return{subscribe:subscribe,set:set,update:update,async fetch(){const json=await api.get("state",{});if(stateFetchIntervalStarted&&!stateFetchIntervalPaused){this.updateState(json)}},updateState(json){for(const callable of get_store_value(preStateUpdateCallbacks)){callable(json)}const dirty=get_store_value(settings_changed);const previous_settings={...get_store_value(current_settings)};config.update(($config=>({...$config,...json})));if(!dirty&&get_store_value(settings_changed)){settings.reset()}if(dirty&&objectsDiffer([previous_settings,get_store_value(current_settings)])){needs_refresh.update(($needs_refresh=>true));settings.reset()}for(const callable of get_store_value(postStateUpdateCallbacks)){callable(json)}},async startPeriodicFetch(){stateFetchIntervalStarted=true;stateFetchIntervalPaused=false;await this.fetch();stateFetchInterval=setInterval((async()=>{await this.fetch()}),5e3)},stopPeriodicFetch(){stateFetchIntervalStarted=false;stateFetchIntervalPaused=false;clearInterval(stateFetchInterval)},pausePeriodicFetch(){if(stateFetchIntervalStarted){stateFetchIntervalPaused=true;clearInterval(stateFetchInterval)}},async resumePeriodicFetch(){stateFetchIntervalPaused=false;if(stateFetchIntervalStarted){await this.startPeriodicFetch()}}}}const state=createState();api.headers=()=>({Accept:"application/json","Content-Type":"application/json","X-WP-Nonce":get_store_value(nonce)});api.url=endpoint=>get_store_value(urls).api+get_store_value(endpoints)[endpoint];api.get=async(endpoint,params)=>{let url=new URL(api.url(endpoint));const searchParams=new URLSearchParams(params);searchParams.forEach((function(value,name){url.searchParams.set(name,value)}));const response=await fetch(url.toString(),{method:"GET",headers:api.headers()});return response.json().then((json=>{json=api.check_response(json);return json}))};api.post=async(endpoint,body)=>{const response=await fetch(api.url(endpoint),{method:"POST",headers:api.headers(),body:JSON.stringify(body)});return response.json().then((json=>{json=api.check_response(json);return json}))};api.put=async(endpoint,body)=>{const response=await fetch(api.url(endpoint),{method:"PUT",headers:api.headers(),body:JSON.stringify(body)});return response.json().then((json=>{json=api.check_response(json);return json}))};api.delete=async(endpoint,body)=>{const response=await fetch(api.url(endpoint),{method:"DELETE",headers:api.headers(),body:JSON.stringify(body)});return response.json().then((json=>{json=api.check_response(json);return json}))};api.check_errors=json=>{if(json.code&&json.message){notifications.add({id:json.code,type:"error",dismissible:true,heading:get_store_value(strings).api_error_notice_heading,message:json.message});delete json.code;delete json.message}return json};api.check_notifications=json=>{const _notifications=json.hasOwnProperty("notifications")?json.notifications:[];if(_notifications){for(const notification of _notifications){notifications.add(notification)}}notifications.cleanup(_notifications);delete json.notifications;return json};api.check_response=json=>{json=api.check_notifications(json);json=api.check_errors(json);return json};const licence=derived(config,($config=>$config.hasOwnProperty("licences")?$config.licences.at(0):[]));const offloadRemainingWithCount=derived(config,($config=>$config.offload_remaining_with_count));const documentation=derived(config,($config=>$config.documentation));const toolsLocked=writable(false);const running=writable("");const toolIcons={"add-metadata":"offload","reverse-add-metadata":"analyzerepair","verify-add-metadata":"analyzerepair","copy-buckets":"move","download-and-remover":"remove",downloader:"download","elementor-analyze-and-repair":"analyzerepair","move-objects":"move","move-private-objects":"move","move-public-objects":"move","remove-local-files":"clean","update-acls":"analyzerepair",uploader:"offload","woocommerce-product-urls":"analyzerepair"};function createTools(){const{subscribe:subscribe,set:set,update:update}=writable({});return{subscribe:subscribe,set:set,async action(tool,action){state.pausePeriodicFetch();tool.status_description=tool.busy_description;tool.short_status_description=tool.busy_description;update((_tools=>{_tools[tool.id]=tool;return _tools}));let result={};const json=await api.put("tools",{id:tool.id,action:action});if(json.hasOwnProperty("ok")){result=json}await state.resumePeriodicFetch();return result},async start(tool){running.update((_running=>tool.id));tool.is_queued=true;return await this.action(tool,"start")},async cancel(tool){tool.is_cancelled=true;return await this.action(tool,"cancel")},async pauseResume(tool){tool.is_paused=!tool.is_paused;return await this.action(tool,"pause_resume")},updateTools(json){if(json.hasOwnProperty("tools")){update((_tools=>({...json.tools})));const runningTool=Object.values(json.tools).find((tool=>tool.is_processing||tool.is_queued||tool.is_paused||tool.is_cancelled));if(runningTool){running.update((_running=>runningTool.id))}else{running.update((_running=>""))}}},icon(tool,isRunning,animated){let icon="tool-generic";let type="default";if(isRunning){if(tool.is_paused){type="paused"}else if(animated){type="running-animated"}else{type="active"}}if(tool&&tool.hasOwnProperty("slug")&&toolIcons.hasOwnProperty(tool.slug)){icon="tool-"+toolIcons[tool.slug]}if(["active","default","paused","running-animated"].includes(type)){icon=icon+"-"+type+".svg"}else{icon=icon+"-default.svg"}return icon}}}const tools=createTools();const assetsNeedsRefresh=writable(false);const assetsSettingsLocked=writable(false);const currentAssetsSettings=derived(config,($config=>$config.assets_settings));const assetsDefinedSettings=derived(config,($config=>$config.assets_defined_settings));derived(config,($config=>$config.assets_domain_check));const enableAssets=derived([licence,config],(([$licence,$config])=>{if($licence.hasOwnProperty("is_set")&&$licence.is_set&&$licence.hasOwnProperty("is_valid")&&$licence.is_valid&&$config.hasOwnProperty("assets_settings")){return true}return false}));function createAssetsSettings(){const{subscribe:subscribe,set:set,update:update}=writable([]);return{subscribe:subscribe,set:set,async save(){const json=await api.put("assets-settings",get_store_value(this));if(json.hasOwnProperty("saved")&&true===json.saved){this.updateSettings(json);return json}return{}},reset(){set({...get_store_value(currentAssetsSettings)})},async fetch(){const json=await api.get("assets-settings",{});this.updateSettings(json)},updateSettings(json){if(json.hasOwnProperty("assets_defined_settings")&&json.hasOwnProperty("assets_settings")){const dirty=get_store_value(assetsSettingsChanged);const previousSettings={...get_store_value(currentAssetsSettings)};config.update((_config=>({..._config,assets_defined_settings:json.assets_defined_settings,assets_settings:json.assets_settings})));if(json.hasOwnProperty("saved")&&true===json.saved){return}if(!dirty&&get_store_value(assetsSettingsChanged)){assetsSettings.reset()}if(dirty&&objectsDiffer([previousSettings,get_store_value(currentAssetsSettings)])){assetsNeedsRefresh.update((_needsRefresh=>true));assetsSettings.reset()}}}}}const assetsSettings=createAssetsSettings();const assetsSettingsChanged=derived([assetsSettings,currentAssetsSettings],objectsDiffer);function wrap(args){if(!args){throw Error("Parameter args is required")}if(!args.component==!args.asyncComponent){throw Error("One and only one of component and asyncComponent is required")}if(args.component){args.asyncComponent=()=>Promise.resolve(args.component)}if(typeof args.asyncComponent!="function"){throw Error("Parameter asyncComponent must be a function")}if(args.conditions){if(!Array.isArray(args.conditions)){args.conditions=[args.conditions]}for(let i=0;i[...$pages,page].sort(((a,b)=>a.position-b.position))))},withPrefix(prefix=null){return get_store_value(this).filter((page=>prefix&&page.route.startsWith(prefix)||!prefix))},routes(prefix=null){let defaultComponent=null;let defaultUserData=null;const routes=new Map;const conditions=[detail=>{if(detail.hasOwnProperty("userData")&&detail.userData.hasOwnProperty("page")&&detail.userData.page.hasOwnProperty("enabled")){return detail.userData.page.enabled()}return true}];for(const page of this.withPrefix(prefix)){const userData={page:page};let route=page.route;if(prefix&&route!==prefix+"/*"){route=route.replace(prefix,"")}routes.set(route,wrap({component:page.component,userData:userData,conditions:conditions}));if(!defaultComponent&&page.default){defaultComponent=page.component;defaultUserData=userData}}if(defaultComponent){routes.set("*",wrap({component:defaultComponent,userData:defaultUserData,conditions:conditions}))}return routes},handleRouteEvent(detail){if(detail.hasOwnProperty("event")){if(!detail.hasOwnProperty("data")){detail.data={}}let route=false;for(const page of get_store_value(this).values()){if(page.events&&page.events[detail.event]&&page.events[detail.event](detail.data)&&!route){route=page.route}}if(route){return route}}if(detail.hasOwnProperty("default")){return detail.default}return false}}}const pages=createPages();const routes=derived(pages,(()=>pages.routes()));function parse(str,loose){if(str instanceof RegExp)return{keys:false,pattern:str};var c,o,tmp,ext,keys=[],pattern="",arr=str.split("/");arr[0]||arr.shift();while(tmp=arr.shift()){c=tmp[0];if(c==="*"){keys.push("wild");pattern+="/(.*)"}else if(c===":"){o=tmp.indexOf("?",1);ext=tmp.indexOf(".",1);keys.push(tmp.substring(1,!!~o?o:!!~ext?ext:tmp.length));pattern+=!!~o&&!~ext?"(?:/([^/]+?))?":"/([^/]+?)";if(!!~ext)pattern+=(!!~o?"?":"")+"\\"+tmp.substring(ext)}else{pattern+="/"+tmp}}return{keys:keys,pattern:new RegExp("^"+pattern+(loose?"(?=$|/)":"/?$"),"i")}}const{Error:Error_1,Object:Object_1$8,console:console_1}=globals;function create_else_block$g(ctx){let switch_instance;let switch_instance_anchor;let current;const switch_instance_spread_levels=[ctx[2]];var switch_value=ctx[0];function switch_props(ctx,dirty){let switch_instance_props={};for(let i=0;i{destroy_component(old_component,1)}));check_outros()}if(switch_value){switch_instance=construct_svelte_component_dev(switch_value,switch_props(ctx,dirty));switch_instance.$on("routeEvent",ctx[7]);create_component(switch_instance.$$.fragment);transition_in(switch_instance.$$.fragment,1);mount_component(switch_instance,switch_instance_anchor.parentNode,switch_instance_anchor)}else{switch_instance=null}}else if(switch_value){const switch_instance_changes=dirty&4?get_spread_update(switch_instance_spread_levels,[get_spread_object(ctx[2])]):{};switch_instance.$set(switch_instance_changes)}},i:function intro(local){if(current)return;if(switch_instance)transition_in(switch_instance.$$.fragment,local);current=true},o:function outro(local){if(switch_instance)transition_out(switch_instance.$$.fragment,local);current=false},d:function destroy(detaching){if(detaching){detach_dev(switch_instance_anchor)}if(switch_instance)destroy_component(switch_instance,detaching)}};dispatch_dev("SvelteRegisterBlock",{block:block,id:create_else_block$g.name,type:"else",source:"(246:0) {:else}",ctx:ctx});return block}function create_if_block$D(ctx){let switch_instance;let switch_instance_anchor;let current;const switch_instance_spread_levels=[{params:ctx[1]},ctx[2]];var switch_value=ctx[0];function switch_props(ctx,dirty){let switch_instance_props={};for(let i=0;i{destroy_component(old_component,1)}));check_outros()}if(switch_value){switch_instance=construct_svelte_component_dev(switch_value,switch_props(ctx,dirty));switch_instance.$on("routeEvent",ctx[6]);create_component(switch_instance.$$.fragment);transition_in(switch_instance.$$.fragment,1);mount_component(switch_instance,switch_instance_anchor.parentNode,switch_instance_anchor)}else{switch_instance=null}}else if(switch_value){const switch_instance_changes=dirty&6?get_spread_update(switch_instance_spread_levels,[dirty&2&&{params:ctx[1]},dirty&4&&get_spread_object(ctx[2])]):{};switch_instance.$set(switch_instance_changes)}},i:function intro(local){if(current)return;if(switch_instance)transition_in(switch_instance.$$.fragment,local);current=true},o:function outro(local){if(switch_instance)transition_out(switch_instance.$$.fragment,local);current=false},d:function destroy(detaching){if(detaching){detach_dev(switch_instance_anchor)}if(switch_instance)destroy_component(switch_instance,detaching)}};dispatch_dev("SvelteRegisterBlock",{block:block,id:create_if_block$D.name,type:"if",source:"(239:0) {#if componentParams}",ctx:ctx});return block}function create_fragment$1e(ctx){let current_block_type_index;let if_block;let if_block_anchor;let current;const if_block_creators=[create_if_block$D,create_else_block$g];const if_blocks=[];function select_block_type(ctx,dirty){if(ctx[1])return 0;return 1}current_block_type_index=select_block_type(ctx);if_block=if_blocks[current_block_type_index]=if_block_creators[current_block_type_index](ctx);const block={c:function create(){if_block.c();if_block_anchor=empty()},l:function claim(nodes){throw new Error_1("options.hydrate only works if the component was compiled with the `hydratable: true` option")},m:function mount(target,anchor){if_blocks[current_block_type_index].m(target,anchor);insert_dev(target,if_block_anchor,anchor);current=true},p:function update(ctx,[dirty]){let previous_block_index=current_block_type_index;current_block_type_index=select_block_type(ctx);if(current_block_type_index===previous_block_index){if_blocks[current_block_type_index].p(ctx,dirty)}else{group_outros();transition_out(if_blocks[previous_block_index],1,1,(()=>{if_blocks[previous_block_index]=null}));check_outros();if_block=if_blocks[current_block_type_index];if(!if_block){if_block=if_blocks[current_block_type_index]=if_block_creators[current_block_type_index](ctx);if_block.c()}else{if_block.p(ctx,dirty)}transition_in(if_block,1);if_block.m(if_block_anchor.parentNode,if_block_anchor)}},i:function intro(local){if(current)return;transition_in(if_block);current=true},o:function outro(local){transition_out(if_block);current=false},d:function destroy(detaching){if(detaching){detach_dev(if_block_anchor)}if_blocks[current_block_type_index].d(detaching)}};dispatch_dev("SvelteRegisterBlock",{block:block,id:create_fragment$1e.name,type:"component",source:"",ctx:ctx});return block}function getLocation(){const hashPosition=window.location.href.indexOf("#/");let location=hashPosition>-1?window.location.href.substr(hashPosition+1):"/";const qsPosition=location.indexOf("?");let querystring="";if(qsPosition>-1){querystring=location.substr(qsPosition+1);location=location.substr(0,qsPosition)}return{location:location,querystring:querystring}}const loc=readable(null,(function start(set){set(getLocation());const update=()=>{set(getLocation())};window.addEventListener("hashchange",update,false);return function stop(){window.removeEventListener("hashchange",update,false)}}));const location$1=derived(loc,(_loc=>_loc.location));const querystring=derived(loc,(_loc=>_loc.querystring));const params=writable(undefined);async function push(location){if(!location||location.length<1||location.charAt(0)!="/"&&location.indexOf("#/")!==0){throw Error("Invalid parameter location")}await tick();history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},undefined);window.location.hash=(location.charAt(0)=="#"?"":"#")+location}async function pop(){await tick();window.history.back()}async function replace(location){if(!location||location.length<1||location.charAt(0)!="/"&&location.indexOf("#/")!==0){throw Error("Invalid parameter location")}await tick();const dest=(location.charAt(0)=="#"?"":"#")+location;try{const newState={...history.state};delete newState["__svelte_spa_router_scrollX"];delete newState["__svelte_spa_router_scrollY"];window.history.replaceState(newState,undefined,dest)}catch(e){console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}function link(node,opts){opts=linkOpts(opts);if(!node||!node.tagName||node.tagName.toLowerCase()!="a"){throw Error('Action "link" can only be used with tags')}updateLink(node,opts);return{update(updated){updated=linkOpts(updated);updateLink(node,updated)}}}function restoreScroll(state){if(state){window.scrollTo(state.__svelte_spa_router_scrollX,state.__svelte_spa_router_scrollY)}else{window.scrollTo(0,0)}}function updateLink(node,opts){let href=opts.href||node.getAttribute("href");if(href&&href.charAt(0)=="/"){href="#"+href}else if(!href||href.length<2||href.slice(0,2)!="#/"){throw Error('Invalid value for "href" attribute: '+href)}node.setAttribute("href",href);node.addEventListener("click",(event=>{event.preventDefault();if(!opts.disabled){scrollstateHistoryHandler(event.currentTarget.getAttribute("href"))}}))}function linkOpts(val){if(val&&typeof val=="string"){return{href:val}}else{return val||{}}}function scrollstateHistoryHandler(href){history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},undefined);window.location.hash=href}function instance$1e($$self,$$props,$$invalidate){let{$$slots:slots={},$$scope:$$scope}=$$props;validate_slots("Router",slots,[]);let{routes:routes={}}=$$props;let{prefix:prefix=""}=$$props;let{restoreScrollState:restoreScrollState=false}=$$props;class RouteItem{constructor(path,component){if(!component||typeof component!="function"&&(typeof component!="object"||component._sveltesparouter!==true)){throw Error("Invalid component object")}if(!path||typeof path=="string"&&(path.length<1||path.charAt(0)!="/"&&path.charAt(0)!="*")||typeof path=="object"&&!(path instanceof RegExp)){throw Error('Invalid value for "path" argument - strings must start with / or *')}const{pattern:pattern,keys:keys}=parse(path);this.path=path;if(typeof component=="object"&&component._sveltesparouter===true){this.component=component.component;this.conditions=component.conditions||[];this.userData=component.userData;this.props=component.props||{}}else{this.component=()=>Promise.resolve(component);this.conditions=[];this.props={}}this._pattern=pattern;this._keys=keys}match(path){if(prefix){if(typeof prefix=="string"){if(path.startsWith(prefix)){path=path.substr(prefix.length)||"/"}else{return null}}else if(prefix instanceof RegExp){const match=path.match(prefix);if(match&&match[0]){path=path.substr(match[0].length)||"/"}else{return null}}}const matches=this._pattern.exec(path);if(matches===null){return null}if(this._keys===false){return matches}const out={};let i=0;while(i{routesList.push(new RouteItem(path,route))}))}else{Object.keys(routes).forEach((path=>{routesList.push(new RouteItem(path,routes[path]))}))}let component=null;let componentParams=null;let props={};const dispatch=createEventDispatcher();async function dispatchNextTick(name,detail){await tick();dispatch(name,detail)}let previousScrollState=null;let popStateChanged=null;if(restoreScrollState){popStateChanged=event=>{if(event.state&&(event.state.__svelte_spa_router_scrollY||event.state.__svelte_spa_router_scrollX)){previousScrollState=event.state}else{previousScrollState=null}};window.addEventListener("popstate",popStateChanged);afterUpdate((()=>{restoreScroll(previousScrollState)}))}let lastLoc=null;let componentObj=null;const unsubscribeLoc=loc.subscribe((async newLoc=>{lastLoc=newLoc;let i=0;while(i{params.set(componentParams)}));return}$$invalidate(0,component=null);componentObj=null;params.set(undefined)}));onDestroy((()=>{unsubscribeLoc();popStateChanged&&window.removeEventListener("popstate",popStateChanged)}));const writable_props=["routes","prefix","restoreScrollState"];Object_1$8.keys($$props).forEach((key=>{if(!~writable_props.indexOf(key)&&key.slice(0,2)!=="$$"&&key!=="slot")console_1.warn(` was created with unknown prop '${key}'`)}));function routeEvent_handler(event){bubble.call(this,$$self,event)}function routeEvent_handler_1(event){bubble.call(this,$$self,event)}$$self.$$set=$$props=>{if("routes"in $$props)$$invalidate(3,routes=$$props.routes);if("prefix"in $$props)$$invalidate(4,prefix=$$props.prefix);if("restoreScrollState"in $$props)$$invalidate(5,restoreScrollState=$$props.restoreScrollState)};$$self.$capture_state=()=>({readable:readable,writable:writable,derived:derived,tick:tick,getLocation:getLocation,loc:loc,location:location$1,querystring:querystring,params:params,push:push,pop:pop,replace:replace,link:link,restoreScroll:restoreScroll,updateLink:updateLink,linkOpts:linkOpts,scrollstateHistoryHandler:scrollstateHistoryHandler,onDestroy:onDestroy,createEventDispatcher:createEventDispatcher,afterUpdate:afterUpdate,parse:parse,routes:routes,prefix:prefix,restoreScrollState:restoreScrollState,RouteItem:RouteItem,routesList:routesList,component:component,componentParams:componentParams,props:props,dispatch:dispatch,dispatchNextTick:dispatchNextTick,previousScrollState:previousScrollState,popStateChanged:popStateChanged,lastLoc:lastLoc,componentObj:componentObj,unsubscribeLoc:unsubscribeLoc});$$self.$inject_state=$$props=>{if("routes"in $$props)$$invalidate(3,routes=$$props.routes);if("prefix"in $$props)$$invalidate(4,prefix=$$props.prefix);if("restoreScrollState"in $$props)$$invalidate(5,restoreScrollState=$$props.restoreScrollState);if("component"in $$props)$$invalidate(0,component=$$props.component);if("componentParams"in $$props)$$invalidate(1,componentParams=$$props.componentParams);if("props"in $$props)$$invalidate(2,props=$$props.props);if("previousScrollState"in $$props)previousScrollState=$$props.previousScrollState;if("popStateChanged"in $$props)popStateChanged=$$props.popStateChanged;if("lastLoc"in $$props)lastLoc=$$props.lastLoc;if("componentObj"in $$props)componentObj=$$props.componentObj};if($$props&&"$$inject"in $$props){$$self.$inject_state($$props.$$inject)}$$self.$$.update=()=>{if($$self.$$.dirty&32){history.scrollRestoration=restoreScrollState?"manual":"auto"}};return[component,componentParams,props,routes,prefix,restoreScrollState,routeEvent_handler,routeEvent_handler_1]}class Router extends SvelteComponentDev{constructor(options){super(options);init(this,options,instance$1e,create_fragment$1e,safe_not_equal,{routes:3,prefix:4,restoreScrollState:5});dispatch_dev("SvelteRegisterComponent",{component:this,tagName:"Router",options:options,id:create_fragment$1e.name})}get routes(){throw new Error_1(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''")}set routes(value){throw new Error_1(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''")}get prefix(){throw new Error_1(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''")}set prefix(value){throw new Error_1(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''")}get restoreScrollState(){throw new Error_1(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''")}set restoreScrollState(value){throw new Error_1(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''")}}const file$12="ui/components/Page.svelte";function create_fragment$1d(ctx){let div;let div_class_value;let current;const default_slot_template=ctx[4].default;const default_slot=create_slot(default_slot_template,ctx,ctx[3],null);const block={c:function create(){div=element("div");if(default_slot)default_slot.c();attr_dev(div,"class",div_class_value="page-wrapper "+ctx[0]);toggle_class(div,"subpage",ctx[1]);add_location(div,file$12,30,0,796)},l:function claim(nodes){throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option")},m:function mount(target,anchor){insert_dev(target,div,anchor);if(default_slot){default_slot.m(div,null)}current=true},p:function update(ctx,[dirty]){if(default_slot){if(default_slot.p&&(!current||dirty&8)){update_slot_base(default_slot,default_slot_template,ctx,ctx[3],!current?get_all_dirty_from_scope(ctx[3]):get_slot_changes(default_slot_template,ctx[3],dirty,null),null)}}if(!current||dirty&1&&div_class_value!==(div_class_value="page-wrapper "+ctx[0])){attr_dev(div,"class",div_class_value)}if(!current||dirty&3){toggle_class(div,"subpage",ctx[1])}},i:function intro(local){if(current)return;transition_in(default_slot,local);current=true},o:function outro(local){transition_out(default_slot,local);current=false},d:function destroy(detaching){if(detaching){detach_dev(div)}if(default_slot)default_slot.d(detaching)}};dispatch_dev("SvelteRegisterBlock",{block:block,id:create_fragment$1d.name,type:"component",source:"",ctx:ctx});return block}function instance$1d($$self,$$props,$$invalidate){let $location;let $current_settings;validate_store(location$1,"location");component_subscribe($$self,location$1,($$value=>$$invalidate(5,$location=$$value)));validate_store(current_settings,"current_settings");component_subscribe($$self,current_settings,($$value=>$$invalidate(6,$current_settings=$$value)));let{$$slots:slots={},$$scope:$$scope}=$$props;validate_slots("Page",slots,["default"]);let{name:name=""}=$$props;let{subpage:subpage=false}=$$props;let{initialSettings:initialSettings=$current_settings}=$$props;const dispatch=createEventDispatcher();setContext("initialSettings",initialSettings);onMount((()=>{dispatch("routeEvent",{event:"page.initial.settings",data:{settings:initialSettings,location:$location}})}));const writable_props=["name","subpage","initialSettings"];Object.keys($$props).forEach((key=>{if(!~writable_props.indexOf(key)&&key.slice(0,2)!=="$$"&&key!=="slot")console.warn(` was created with unknown prop '${key}'`)}));$$self.$$set=$$props=>{if("name"in $$props)$$invalidate(0,name=$$props.name);if("subpage"in $$props)$$invalidate(1,subpage=$$props.subpage);if("initialSettings"in $$props)$$invalidate(2,initialSettings=$$props.initialSettings);if("$$scope"in $$props)$$invalidate(3,$$scope=$$props.$$scope)};$$self.$capture_state=()=>({onMount:onMount,createEventDispatcher:createEventDispatcher,setContext:setContext,location:location$1,current_settings:current_settings,name:name,subpage:subpage,initialSettings:initialSettings,dispatch:dispatch,$location:$location,$current_settings:$current_settings});$$self.$inject_state=$$props=>{if("name"in $$props)$$invalidate(0,name=$$props.name);if("subpage"in $$props)$$invalidate(1,subpage=$$props.subpage);if("initialSettings"in $$props)$$invalidate(2,initialSettings=$$props.initialSettings)};if($$props&&"$$inject"in $$props){$$self.$inject_state($$props.$$inject)}return[name,subpage,initialSettings,$$scope,slots]}class Page extends SvelteComponentDev{constructor(options){super(options);init(this,options,instance$1d,create_fragment$1d,safe_not_equal,{name:0,subpage:1,initialSettings:2});dispatch_dev("SvelteRegisterComponent",{component:this,tagName:"Page",options:options,id:create_fragment$1d.name})}get name(){throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''")}set name(value){throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''")}get subpage(){throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''")}set subpage(value){throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''")}get initialSettings(){throw new Error(": Props cannot be read directly from the component instance unless compiling with 'accessors: true' or ''")}set initialSettings(value){throw new Error(": Props cannot be set directly on the component instance unless compiling with 'accessors: true' or ''")}}const file$11="ui/components/Button.svelte";function create_if_block$C(ctx){let img;let img_src_value;const block={c:function create(){img=element("img");attr_dev(img,"class","icon refresh");if(!src_url_equal(img.src,img_src_value=ctx[15](ctx[11])))attr_dev(img,"src",img_src_value);attr_dev(img,"alt",ctx[12]);toggle_class(img,"refreshing",ctx[11]);add_location(img,file$11,72,2,1802)},m:function mount(target,anchor){insert_dev(target,img,anchor)},p:function update(ctx,dirty){if(dirty&2048&&!src_url_equal(img.src,img_src_value=ctx[15](ctx[11]))){attr_dev(img,"src",img_src_value)}if(dirty&4096){attr_dev(img,"alt",ctx[12])}if(dirty&2048){toggle_class(img,"refreshing",ctx[11])}},d:function destroy(detaching){if(detaching){detach_dev(img)}}};dispatch_dev("SvelteRegisterBlock",{block:block,id:create_if_block$C.name,type:"if",source:"(72:1) {#if refresh}",ctx:ctx});return block}function create_fragment$1c(ctx){let button;let t;let button_disabled_value;let current;let mounted;let dispose;let if_block=ctx[7]&&create_if_block$C(ctx);const default_slot_template=ctx[17].default;const default_slot=create_slot(default_slot_template,ctx,ctx[16],null);const block={c:function create(){button=element("button");if(if_block)if_block.c();t=space();if(default_slot)default_slot.c();attr_dev(button,"class",ctx[13]);attr_dev(button,"title",ctx[12]);button.disabled=button_disabled_value=ctx[9]||ctx[11];toggle_class(button,"btn-xs",ctx[1]);toggle_class(button,"btn-sm",ctx[2]);toggle_class(button,"btn-md",ctx[4]);toggle_class(button,"btn-lg",ctx[3]);toggle_class(button,"btn-primary",ctx[5]);toggle_class(button,"btn-outline",ctx[8]);toggle_class(button,"btn-expandable",ctx[6]);toggle_class(button,"btn-disabled",ctx[9]);toggle_class(button,"btn-expanded",ctx[10]);toggle_class(button,"btn-refresh",ctx[7]);toggle_class(button,"btn-refreshing",ctx[11]);add_location(button,file$11,51,0,1322)},l:function claim(nodes){throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option")},m:function mount(target,anchor){insert_dev(target,button,anchor);if(if_block)if_block.m(button,null);append_dev(button,t);if(default_slot){default_slot.m(button,null)}ctx[20](button);current=true;if(!mounted){dispose=[listen_dev(button,"click",prevent_default(ctx[18]),false,true,false,false),listen_dev(button,"focusout",ctx[19],false,false,false,false),listen_dev(button,"keyup",ctx[14],false,false,false,false)];mounted=true}},p:function update(ctx,[dirty]){if(ctx[7]){if(if_block){if_block.p(ctx,dirty)}else{if_block=create_if_block$C(ctx);if_block.c();if_block.m(button,t)}}else if(if_block){if_block.d(1);if_block=null}if(default_slot){if(default_slot.p&&(!current||dirty&65536)){update_slot_base(default_slot,default_slot_template,ctx,ctx[16],!current?get_all_dirty_from_scope(ctx[16]):get_slot_changes(default_slot_template,ctx[16],dirty,null),null)}}if(!current||dirty&4096){attr_dev(button,"title",ctx[12])}if(!current||dirty&2560&&button_disabled_value!==(button_disabled_value=ctx[9]||ctx[11])){prop_dev(button,"disabled",button_disabled_value)}if(!current||dirty&2){toggle_class(button,"btn-xs",ctx[1])}if(!current||dirty&4){toggle_class(button,"btn-sm",ctx[2])}if(!current||dirty&16){toggle_class(button,"btn-md",ctx[4])}if(!current||dirty&8){toggle_class(button,"btn-lg",ctx[3])}if(!current||dirty&32){toggle_class(button,"btn-primary",ctx[5])}if(!current||dirty&256){toggle_class(button,"btn-outline",ctx[8])}if(!current||dirty&64){toggle_class(button,"btn-expandable",ctx[6])}if(!current||dirty&512){toggle_class(button,"btn-disabled",ctx[9])}if(!current||dirty&1024){toggle_class(button,"btn-expanded",ctx[10])}if(!current||dirty&128){toggle_class(button,"btn-refresh",ctx[7])}if(!current||dirty&2048){toggle_class(button,"btn-refreshing",ctx[11])}},i:function intro(local){if(current)return;transition_in(default_slot,local);current=true},o:function outro(local){transition_out(default_slot,local);current=false},d:function destroy(detaching){if(detaching){detach_dev(button)}if(if_block)if_block.d();if(default_slot)default_slot.d(detaching);ctx[20](null);mounted=false;run_all(dispose)}};dispatch_dev("SvelteRegisterBlock",{block:block,id:create_fragment$1c.name,type:"component",source:"",ctx:ctx});return block}function instance$1c($$self,$$props,$$invalidate){let $urls;validate_store(urls,"urls");component_subscribe($$self,urls,($$value=>$$invalidate(21,$urls=$$value)));let{$$slots:slots={},$$scope:$$scope}=$$props;validate_slots("Button",slots,["default"]);const classes=$$props.class?$$props.class:"";const dispatch=createEventDispatcher();let{ref:ref={}}=$$props;let{extraSmall:extraSmall=false}=$$props;let{small:small=false}=$$props;let{large:large=false}=$$props;let{medium:medium=!extraSmall&&!small&&!large}=$$props;let{primary:primary=false}=$$props;let{expandable:expandable=false}=$$props;let{refresh:refresh=false}=$$props;let{outline:outline=!primary&&!expandable&&!refresh}=$$props;let{disabled:disabled=false}=$$props;let{expanded:expanded=false}=$$props;let{refreshing:refreshing=false}=$$props;let{title:title=""}=$$props;function handleKeyup(event){if(event.key==="Escape"){event.preventDefault();dispatch("cancel")}}function refreshIcon(refreshing){return $urls.assets+"img/icon/"+(refreshing?"refresh-disabled.svg":"refresh.svg")}function click_handler(event){bubble.call(this,$$self,event)}function focusout_handler(event){bubble.call(this,$$self,event)}function button_binding($$value){binding_callbacks[$$value?"unshift":"push"]((()=>{ref=$$value;$$invalidate(0,ref)}))}$$self.$$set=$$new_props=>{$$invalidate(23,$$props=assign(assign({},$$props),exclude_internal_props($$new_props)));if("ref"in $$new_props)$$invalidate(0,ref=$$new_props.ref);if("extraSmall"in $$new_props)$$invalidate(1,extraSmall=$$new_props.extraSmall);if("small"in $$new_props)$$invalidate(2,small=$$new_props.small);if("large"in $$new_props)$$invalidate(3,large=$$new_props.large);if("medium"in $$new_props)$$invalidate(4,medium=$$new_props.medium);if("primary"in $$new_props)$$invalidate(5,primary=$$new_props.primary);if("expandable"in $$new_props)$$invalidate(6,expandable=$$new_props.expandable);if("refresh"in $$new_props)$$invalidate(7,refresh=$$new_props.refresh);if("outline"in $$new_props)$$invalidate(8,outline=$$new_props.outline);if("disabled"in $$new_props)$$invalidate(9,disabled=$$new_props.disabled);if("expanded"in $$new_props)$$invalidate(10,expanded=$$new_props.expanded);if("refreshing"in $$new_props)$$invalidate(11,refreshing=$$new_props.refreshing);if("title"in $$new_props)$$invalidate(12,title=$$new_props.title);if("$$scope"in $$new_props)$$invalidate(16,$$scope=$$new_props.$$scope)};$$self.$capture_state=()=>({createEventDispatcher:createEventDispatcher,urls:urls,classes:classes,dispatch:dispatch,ref:ref,extraSmall:extraSmall,small:small,large:large,medium:medium,primary:primary,expandable:expandable,refresh:refresh,outline:outline,disabled:disabled,expanded:expanded,refreshing:refreshing,title:title,handleKeyup:handleKeyup,refreshIcon:refreshIcon,$urls:$urls});$$self.$inject_state=$$new_props=>{$$invalidate(23,$$props=assign(assign({},$$props),$$new_props));if("ref"in $$props)$$invalidate(0,ref=$$new_props.ref);if("extraSmall"in $$props)$$invalidate(1,extraSmall=$$new_props.extraSmall);if("small"in $$props)$$invalidate(2,small=$$new_props.small);if("large"in $$props)$$invalidate(3,large=$$new_props.large);if("medium"in $$props)$$invalidate(4,medium=$$new_props.medium);if("primary"in $$props)$$invalidate(5,primary=$$new_props.primary);if("expandable"in $$props)$$invalidate(6,expandable=$$new_props.expandable);if("refresh"in $$props)$$invalidate(7,refresh=$$new_props.refresh);if("outline"in $$props)$$invalidate(8,outline=$$new_props.outline);if("disabled"in $$props)$$invalidate(9,disabled=$$new_props.disabled);if("expanded"in $$props)$$invalidate(10,expanded=$$new_props.expanded);if("refreshing"in $$props)$$invalidate(11,refreshing=$$new_props.refreshing);if("title"in $$props)$$invalidate(12,title=$$new_props.title)};if($$props&&"$$inject"in $$props){$$self.$inject_state($$props.$$inject)}$$props=exclude_internal_props($$props);return[ref,extraSmall,small,large,medium,primary,expandable,refresh,outline,disabled,expanded,refreshing,title,classes,handleKeyup,refreshIcon,$$scope,slots,click_handler,focusout_handler,button_binding]}class Button extends SvelteComponentDev{constructor(options){super(options);init(this,options,instance$1c,create_fragment$1c,safe_not_equal,{ref:0,extraSmall:1,small:2,large:3,medium:4,primary:5,expandable:6,refresh:7,outline:8,disabled:9,expanded:10,refreshing:11,title:12});dispatch_dev("SvelteRegisterComponent",{component:this,tagName:"Button",options:options,id:create_fragment$1c.name})}get ref(){throw new Error("