';function Ge(e){let t,n,r,i,o,a,l,s,c,u,d,p,m,g,v,y,b=(e[7]?e[5].length:"?")+"";return c=new je({props:{icon:' '}}),c.$on("click",e[16]),d=new je({props:{icon:' '}}),d.$on("click",e[17]),m=new je({props:{icon:Ue}}),m.$on("click",(function(){h(e[1])&&e[1].apply(this,arguments)})),{c(){t=T("div"),n=T("input"),r=A(),i=T("span"),o=$(e[6]),a=$("/"),l=$(b),s=A(),Ce(c.$$.fragment),u=A(),Ce(d.$$.fragment),p=A(),Ce(m.$$.fragment),H(n,"type","text"),H(n,"class","svelte-w44ehq"),H(i,"class","svelte-w44ehq"),H(t,"class","editor__search svelte-w44ehq")},m(f,h){L(f,t,h),S(t,n),e[14](n),P(n,e[4]),S(t,r),S(t,i),S(i,o),S(i,a),S(i,l),S(t,s),Se(c,t,null),S(t,u),Se(d,t,null),S(t,p),Se(m,t,null),g=!0,v||(y=[N(n,"input",e[15]),N(n,"input",e[9]),N(n,"input",e[2]),N(n,"keydown",e[8])],v=!0)},p(t,r){e=t,16&r&&n.value!==e[4]&&P(n,e[4]),(!g||64&r)&&z(o,e[6]),(!g||160&r)&&b!==(b=(e[7]?e[5].length:"?")+"")&&z(l,b)},i(e){g||(me(c.$$.fragment,e),me(d.$$.fragment,e),me(m.$$.fragment,e),g=!0)},o(e){ge(c.$$.fragment,e),ge(d.$$.fragment,e),ge(m.$$.fragment,e),g=!1},d(n){n&&M(t),e[14](null),Le(c),Le(d),Le(m),v=!1,f(y)}}}function Ke(e){let t,n,r=e[0]&&Ge(e);return{c(){r&&r.c(),t=O()},m(e,i){r&&r.m(e,i),L(e,t,i),n=!0},p(e,[n]){e[0]?r?(r.p(e,n),1&n&&me(r,1)):(r=Ge(e),r.c(),me(r,1),r.m(t.parentNode,t)):r&&(he(),ge(r,1,1,()=>{r=null}),pe())},i(e){n||(me(r),n=!0)},o(e){ge(r),n=!1},d(e){r&&r.d(e),e&&M(t)}}}function qe(e,t,n){let r,i,{active:o}=t,{instance:a}=t,{closeHandler:l=(()=>{})}=t,s={},c=[],u=0,d=[];async function f(){await ne(),r.focus()}function h(){const e=a;let t=u;if(c.length){t===c.length&&(t=n(6,u=0)),e.setSelection(c[t].anchor,c[t].head),e.scrollIntoView({from:c[t].anchor,to:c[t].head},20),d.forEach(e=>e.clear());const r=e.markText(c[t].anchor,c[t].head,{className:"cm-search-mark"});d.push(r),n(6,u++,u)}}function p(){const e=a;if(c.length){n(6,0===u||1===u?u=c.length:--u);let t=u-1;e.setSelection(c[t].anchor,c[t].head),e.scrollIntoView({from:c[t].anchor,to:c[t].head},20),d.forEach(e=>e.clear());const r=e.markText(c[t].anchor,c[t].head,{className:"cm-search-mark"});d.push(r)}}let m;return e.$$set=e=>{"active"in e&&n(0,o=e.active),"instance"in e&&n(12,a=e.instance),"closeHandler"in e&&n(1,l=e.closeHandler)},e.$$.update=()=>{266241&e.$$.dirty&&(o||(n(4,i=void 0),a.removeOverlay(s),a.focus(),n(6,u=0),n(5,c=[]),d.forEach(e=>e.clear()))),16&e.$$.dirty&&n(7,m=i?i.trim():""),1&e.$$.dirty&&o&&f()},[o,l,function(){const e=a.getSearchCursor(m,{line:0,ch:0},{caseFold:!0});for(n(5,c=[]),n(6,u=0),d.forEach(e=>e.clear());e.findNext();)c.push({anchor:e.from(),head:e.to()})},r,i,c,u,m,function(e){"Escape"===e.key&&l(),"Enter"===e.key&&h()},function(){const e=a,t=new RegExp(m.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"),"gi");s&&e.removeOverlay(s),m.length>0&&(n(18,s={token(e){t.lastIndex=e.pos;const n=t.exec(e.string);if(n&&n.index==e.pos)return e.pos+=n[0].length||1,"searching";n?e.pos=n.index:e.skipToEnd()}}),e.addOverlay(s))},h,p,a,f,function(e){Y[e?"unshift":"push"](()=>{r=e,n(3,r)})},function(){i=this.value,n(4,i),n(0,o),n(12,a),n(18,s),n(19,d)},()=>h(),()=>p()]}class Xe extends Te{constructor(e){super(),Me(this,e,qe,Ke,p,{active:0,instance:12,closeHandler:1,focusInput:13,getMatches:2})}get focusInput(){return this.$$.ctx[13]}get getMatches(){return this.$$.ctx[2]}}function Ye(e){let t,n,r;var i=Xe;function o(e){return{props:{active:e[2],closeHandler:e[8],instance:Ze}}}return i&&(t=new i(o(e)),e[9](t)),{c(){t&&Ce(t.$$.fragment),n=O()},m(e,i){t&&Se(t,e,i),L(e,n,i),r=!0},p(e,r){const a={};if(4&r&&(a.active=e[2]),4&r&&(a.closeHandler=e[8]),0&r&&(a.instance=Ze),i!==(i=Xe)){if(t){he();const e=t;ge(e.$$.fragment,1,0,()=>{Le(e,1)}),pe()}i?(t=new i(o(e)),e[9](t),Ce(t.$$.fragment),me(t.$$.fragment,1),Se(t,n.parentNode,n)):t=null}else i&&t.$set(a)},i(e){r||(t&&me(t.$$.fragment,e),r=!0)},o(e){t&&ge(t.$$.fragment,e),r=!1},d(r){e[9](null),r&&M(n),t&&Le(t,r)}}}function Qe(e){let t,n,r,i,o=Ze&&Ye(e);return{c(){t=T("textarea"),n=A(),o&&o.c(),r=O()},m(a,l){L(a,t,l),e[7](t),L(a,n,l),o&&o.m(a,l),L(a,r,l),i=!0},p(e,[t]){Ze?o?(o.p(e,t),0&t&&me(o,1)):(o=Ye(e),o.c(),me(o,1),o.m(r.parentNode,r)):o&&(he(),ge(o,1,1,()=>{o=null}),pe())},i(e){i||(me(o),i=!0)},o(e){ge(o),i=!1},d(i){i&&M(t),e[7](null),i&&M(n),o&&o.d(i),i&&M(r)}}}let Ze,Je=null,et=null;function tt(){return null!==et&&0!==et.localeCompare(Je)}function nt(e){Je=e}function rt(e){et=e}function it(){return Ze}function ot(e,t){"+input"===t.origin&&1===t.text.length&&". "===t.text[0]&&t.update(t.from,t.to,[" "])}function at(){Ze.setOption("readOnly","nocursor"),Ze.display.wrapper.style.opacity="0.30"}function lt(){Ze.setOption("readOnly",!1),Ze.display.wrapper.removeAttribute("style")}function st(){return Ze.getValue()}function ct(e,t,n){let r,i;m(e,Ie,e=>n(12,r=e)),m(e,_e,e=>n(13,i=e));let{saveHandler:o=(()=>{})}=t;const a=function(){const e=K();return(t,n)=>{const r=e.$$.callbacks[t];if(r){const i=W(t,n);r.slice().forEach(t=>{t.call(e,i)})}}}();let l,s,c,u=[],d=!1;const f={asi:!0,esversion:9};function h(e,t){const n=t.origin;d&&c.getMatches(),"setValue"!==n&&(et=e.getValue(),tt()&&a("message",{name:"enableButtons"})),"undo"!==n&&"redo"!==n||tt()||a("message",{name:"disableButtons"})}function p(e){const t="enable"===e&&f;Ze.setOption("lint",t),Ze.refresh()}return e.$$set=e=>{"saveHandler"in e&&n(3,o=e.saveHandler)},e.$$.update=()=>{4096&e.$$.dirty&&Ze&&(Ze.setOption("showInvisibles",r.showInvisibles),Ze.setOption("tabSize",parseInt(r.tabSize)),Ze.setOption("indentUnit",parseInt(r.tabSize))),8192&e.$$.dirty&&i.includes("saving")&&(n(11,s=Ze.getCursor()),at()),10240&e.$$.dirty&&i.includes("ready")&&_e.getOldState().includes("saving")&&(lt(),Ze.focus(),Ze.setCursor(s)),8192&e.$$.dirty&&(i.includes("trashing")||i.includes("updating"))&&at(),8192&e.$$.dirty&&i&&_e.getOldState().includes("trashing")&&(Je=null,et=null,lt()),8192&e.$$.dirty&&i&&_e.getOldState().includes("updating")&&(et=Ze.getValue(),lt()),4096&e.$$.dirty&&(Ze&&r.lint?p("enable"):Ze&&!r.lint&&p("disable"))},[l,c,d,o,function(){const e=!!r.lint&&f;Ze=Re.fromTextArea(l,{mode:"javascript",autoCloseBrackets:!0,continueComments:!1,foldGutter:!0,lineNumbers:!0,lineWrapping:!0,matchBrackets:!0,smartIndent:!0,styleActiveLine:!0,indentUnit:parseInt(r.tabSize),showInvisibles:r.showInvisibles,tabSize:parseInt(r.tabSize),highlightSelectionMatches:!1,lint:e,hintOptions:{useGlobalScope:!0},gutters:["CodeMirror-lint-markers","CodeMirror-linenumbers","CodeMirror-foldgutter"],extraKeys:{"Ctrl-Space":"autocomplete","Cmd-/":"toggleComment","Cmd-S":()=>o(),"Cmd-F":()=>{d?c.focusInput():n(2,d=!0)},Esc:()=>{n(2,d=!1)},Tab:e=>{var t=Array(e.getOption("indentUnit")+1).join(" ");e.replaceSelection(t)}}}),Ze.on("keydown",(e,t)=>{if("Backspace"===t.code)return u=[];u.push(t.code),function(e){const t=u.every(e=>1===u.length?e.startsWith("Digit")||e.startsWith("Key"):2===u.length?e.startsWith("Digit")||e.startsWith("Key")||e.startsWith("Shift"):void 0);r.autoHint&&!e.state.completionActive&&0!=e.getCursor().ch&&u.length<3&&t&&e.showHint({completeSingle:!1})}(e)}),Ze.on("keyup",(e,t)=>u.splice(u.indexOf(t.code),1)),Ze.on("blur",()=>u=[]),Ze.on("change",h),Ze.on("beforeChange",ot)},function(){i.includes("ready")&&(Ze.setValue(Je),et=null,Ze.focus(),a("message",{name:"disableButtons"}))},st,function(e){Y[e?"unshift":"push"](()=>{l=e,n(0,l)})},()=>{n(2,d=!1)},function(e){Y[e?"unshift":"push"](()=>{c=e,n(1,c)})}]}class ut extends Te{constructor(e){super(),Me(this,e,ct,Qe,p,{saveHandler:3,init:4,discardChanges:5,getValue:6})}get init(){return this.$$.ctx[4]}get discardChanges(){return this.$$.ctx[5]}get getValue(){return st}}let dt=!!safari.self;function ft(e){const t=dt?e.name:e.detail.name,n=dt?e.message.data:e.detail.data,r=dt?e.message.error:e.detail.error;switch(r&&(console.error(r),Pe.add(r,"error",!0)),t){case"RESP_INIT_DATA":if(r)return _e.add("init-error");for(const[e,t]of Object.entries(n))"true"!==t&&"false"!==t||(n[e]=JSON.parse(t));Ie.set(n),_e.add("items-loading"),_e.remove("init"),safari.extension.dispatchMessage("REQ_ALL_FILES_DATA");break;case"RESP_ALL_FILES_DATA":if(r)return;We.set(n),_e.remove("items-loading");break;case"RESP_FILE_SAVE":r||(We.update(e=>{const t=e.findIndex(e=>e.active),r=null!=e[t].disabled&&e[t].disabled,i=e[t].type,o=null==e[t].visible||e[t].visible;return e[t]=n,e[t].active=!0,e[t].disabled=r,e[t].type=i,e[t].visible=o,e}),nt(n.content)),_e.remove("saving");break;case"RESP_FILE_TRASH":r||We.update(e=>e.filter(e=>!e.active)),_e.remove("trashing");break;case"RESP_TOGGLE_FILE":r||We.update(e=>{const t=e.find(e=>e.filename===n.filename);return t.disabled=!t.disabled,e}),document.querySelector(`[data-filename="${n.filename}"] input`).disabled=!1;break;case"RESP_OPEN_SAVE_LOCATION":case"RESP_UPDATE_SETTINGS":case"RESP_UPDATE_BLACKLIST":break;default:console.error("message from swift has no handler - "+t)}}function ht(e){let t,n,r,i,o,a,l,s,c,u,d=e[0].message+"";return l=new je({props:{icon:Ue}}),l.$on("click",e[2]),{c(){t=T("li"),n=T("div"),r=A(),i=T("span"),o=$(d),a=A(),Ce(l.$$.fragment),H(n,"class","svelte-2hv0ag"),H(i,"class","svelte-2hv0ag"),H(t,"class","svelte-2hv0ag"),_(t,"error","error"===e[0].type),_(t,"info","info"===e[0].type),_(t,"warn","warn"===e[0].type)},m(s,c){L(s,t,c),S(t,n),n.innerHTML=e[1],S(t,r),S(t,i),S(i,o),S(t,a),Se(l,t,null),u=!0},p(e,[n]){(!u||1&n)&&d!==(d=e[0].message+"")&&z(o,d),1&n&&_(t,"error","error"===e[0].type),1&n&&_(t,"info","info"===e[0].type),1&n&&_(t,"warn","warn"===e[0].type)},i(e){u||(me(l.$$.fragment,e),re(()=>{c&&c.end(1),s||(s=ye(t,Ee,{y:24,duration:150})),s.start()}),u=!0)},o(e){ge(l.$$.fragment,e),s&&s.invalidate(),c=be(t,Ne,{duration:150}),u=!1},d(e){e&&M(t),Le(l),e&&c&&c.end()}}}function pt(e,t,n){let{item:r}=t;const i="error"===r.type?' ':"info"===r.type?' ':' ';return e.$$set=e=>{"item"in e&&n(0,r=e.item)},[r,i,function(t){q(e,t)}]}class mt extends Te{constructor(e){super(),Me(this,e,pt,ht,p,{item:0})}}function gt(e){let t,n,r,i,o;n=new je({props:{icon:e[0],title:e[2],disabled:e[1]}}),n.$on("click",e[4]);const a=e[6].default,l=function(e,t,n,r){if(e){const i=g(e,t,n,r);return e[0](i)}}(a,e,e[5],null),s=l||function(e){let t;return{c(){t=T("li"),t.textContent="At least one slot is required..."},m(e,n){L(e,t,n)},d(e){e&&M(t)}}}();return{c(){t=T("div"),Ce(n.$$.fragment),r=A(),i=T("ul"),s&&s.c(),H(i,"class","svelte-t5xyft"),H(t,"class","svelte-t5xyft"),_(t,"active",e[3])},m(e,a){L(e,t,a),Se(n,t,null),S(t,r),S(t,i),s&&s.m(i,null),o=!0},p(e,[r]){const i={};1&r&&(i.icon=e[0]),4&r&&(i.title=e[2]),2&r&&(i.disabled=e[1]),n.$set(i),l&&l.p&&32&r&&v(l,a,e,e[5],r,null,null),8&r&&_(t,"active",e[3])},i(e){o||(me(n.$$.fragment,e),me(s,e),o=!0)},o(e){ge(n.$$.fragment,e),ge(s,e),o=!1},d(e){e&&M(t),Le(n),s&&s.d(e)}}}function vt(e,t,n){let{$$slots:r={},$$scope:i}=t,{icon:o="plus"}=t,{disabled:a=!1}=t,{title:l}=t,s=!1;return e.$$set=e=>{"icon"in e&&n(0,o=e.icon),"disabled"in e&&n(1,a=e.disabled),"title"in e&&n(2,l=e.title),"$$scope"in e&&n(5,i=e.$$scope)},[o,a,l,s,function(e){n(3,s=!s),document.body.addEventListener("click",(function t(r){r.target!=e.target?(n(3,s=!1),document.body.removeEventListener("click",t)):s||document.body.removeEventListener("click",t)}))},i,r]}class yt extends Te{constructor(e){super(),Me(this,e,vt,gt,p,{icon:0,disabled:1,title:2})}}function bt(e){let t,n,r,i,o,a,l,s,c,u,d,h,p,m,g,v,y,b="lastModifiedAsc"===e[2]?" *":"",w="lastModifiedDesc"===e[2]?" *":"",x="nameAsc"===e[2]?" *":"",k="nameDesc"===e[2]?" *":"";return{c(){t=T("li"),n=$("Last Modified: Asc"),r=$(b),i=A(),o=T("li"),a=$("Last Modified: Desc"),l=$(w),s=A(),c=T("li"),u=$("Name: Asc"),d=$(x),h=A(),p=T("li"),m=$("Name: Desc"),g=$(k),_(t,"selected","lastModifiedAsc"===e[2]),_(o,"selected","lastModifiedDesc"===e[2]),_(c,"selected","nameAsc"===e[2]),_(p,"selected","nameDesc"===e[2])},m(f,b){L(f,t,b),S(t,n),S(t,r),L(f,i,b),L(f,o,b),S(o,a),S(o,l),L(f,s,b),L(f,c,b),S(c,u),S(c,d),L(f,h,b),L(f,p,b),S(p,m),S(p,g),v||(y=[N(t,"click",e[5]),N(o,"click",e[6]),N(c,"click",e[7]),N(p,"click",e[8])],v=!0)},p(e,n){4&n&&b!==(b="lastModifiedAsc"===e[2]?" *":"")&&z(r,b),4&n&&_(t,"selected","lastModifiedAsc"===e[2]),4&n&&w!==(w="lastModifiedDesc"===e[2]?" *":"")&&z(l,w),4&n&&_(o,"selected","lastModifiedDesc"===e[2]),4&n&&x!==(x="nameAsc"===e[2]?" *":"")&&z(d,x),4&n&&_(c,"selected","nameAsc"===e[2]),4&n&&k!==(k="nameDesc"===e[2]?" *":"")&&z(g,k),4&n&&_(p,"selected","nameDesc"===e[2])},d(e){e&&M(t),e&&M(i),e&&M(o),e&&M(s),e&&M(c),e&&M(h),e&&M(p),v=!1,f(y)}}}function wt(e){let t,n;return t=new je({props:{icon:' ',disabled:e[1]}}),t.$on("click",e[9]),{c(){Ce(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},p(e,n){const r={};2&n&&(r.disabled=e[1]),t.$set(r)},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Le(t,e)}}}function xt(e){let t,n,r,i,o,a,l,s;i=new yt({props:{icon:' ',disabled:e[1],$$slots:{default:[bt]},$$scope:{ctx:e}}});let c=e[0]&&wt(e);return{c(){t=T("div"),n=T("input"),r=A(),Ce(i.$$.fragment),o=A(),c&&c.c(),H(n,"type","text"),H(n,"placeholder","Search and filter here..."),H(n,"autocapitalize","off"),H(n,"autocomplete","off"),H(n,"spellcheck","false"),H(n,"autocorrect","off"),n.disabled=e[1],H(n,"class","svelte-ohkxxw"),H(t,"class","filter svelte-ohkxxw")},m(u,d){L(u,t,d),S(t,n),P(n,e[0]),S(t,r),Se(i,t,null),S(t,o),c&&c.m(t,null),a=!0,l||(s=N(n,"input",e[4]),l=!0)},p(e,[r]){(!a||2&r)&&(n.disabled=e[1]),1&r&&n.value!==e[0]&&P(n,e[0]);const o={};2&r&&(o.disabled=e[1]),16388&r&&(o.$$scope={dirty:r,ctx:e}),i.$set(o),e[0]?c?(c.p(e,r),1&r&&me(c,1)):(c=wt(e),c.c(),me(c,1),c.m(t,null)):c&&(he(),ge(c,1,1,()=>{c=null}),pe())},i(e){a||(me(i.$$.fragment,e),me(c),a=!0)},o(e){ge(i.$$.fragment,e),ge(c),a=!1},d(e){e&&M(t),Le(i),c&&c.d(),l=!1,s()}}}function kt(e,t,n){let r,i,o;m(e,_e,e=>n(10,r=e)),m(e,Ie,e=>n(11,i=e)),m(e,We,e=>n(12,o=e));let a="";function l(e){Ie.updateSingleSetting("sortOrder",e)}let s,c;return e.$$.update=()=>{1024&e.$$.dirty&&n(1,s=!r.includes("ready")),2048&e.$$.dirty&&n(2,c=i.sortOrder),1&e.$$.dirty&&function(e){!function(e,t,n=t){e.set(n)}(We,o=o.map(t=>{const n=t.filename.toLowerCase().includes(e.trim().toLowerCase());return n!=t.visible?{...t,visible:n}:t}),o)}(a)},[a,s,c,l,function(){a=this.value,n(0,a)},()=>l("lastModifiedAsc"),()=>l("lastModifiedDesc"),()=>l("nameAsc"),()=>l("nameDesc"),()=>n(0,a="")]}class Ct extends Te{constructor(e){super(),Me(this,e,kt,xt,p,{})}}var St=' ';function Lt(e){let t,n,r;return{c(){t=T("div"),H(t,"class","svelte-1sfgbv")},m(e,n){L(e,t,n),t.innerHTML=St,r=!0},p:s,i(e){r||(n&&n.end(1),r=!0)},o(e){n=be(t,Ne,{duration:125}),r=!1},d(e){e&&M(t),e&&n&&n.end()}}}class Mt extends Te{constructor(e){super(),Me(this,e,null,Lt,p,{})}}function Tt(e){let t,n;return{c(){t=T("div"),H(t,"class",n="script__tag "+(e[0]?"script__tag--"+e[0]:"")+" svelte-1q6zthi")},m(e,n){L(e,t,n)},p(e,[r]){1&r&&n!==(n="script__tag "+(e[0]?"script__tag--"+e[0]:"")+" svelte-1q6zthi")&&H(t,"class",n)},i:s,o:s,d(e){e&&M(t)}}}function $t(e,t,n){let{type:r}=t;return e.$$set=e=>{"type"in e&&n(0,r=e.type)},[r]}class At extends Te{constructor(e){super(),Me(this,e,$t,Tt,p,{type:0})}}function Ot(e){let t,n,r,i,o,a,l,c;return{c(){t=T("label"),n=T("input"),r=A(),i=T("span"),o=A(),H(n,"type","checkbox"),H(n,"class","svelte-72hvfe"),H(i,"class","svelte-72hvfe"),a=new F(null),H(t,"class","svelte-72hvfe")},m(s,u){L(s,t,u),S(t,n),n.checked=e[0],S(t,r),S(t,i),S(t,o),a.m(St,t),l||(c=[N(n,"click",E(e[1])),N(n,"change",e[2]),N(t,"click",E(Nt))],l=!0)},p(e,[t]){1&t&&(n.checked=e[0])},i:s,o:s,d(e){e&&M(t),l=!1,f(c)}}}const Nt=()=>{};function Et(e,t,n){let{checked:r=!1}=t;return e.$$set=e=>{"checked"in e&&n(0,r=e.checked)},[r,function(t){q(e,t)},function(){r=this.checked,n(0,r)}]}class Ht extends Te{constructor(e){super(),Me(this,e,Et,Ot,p,{checked:0})}}function zt(e){let t,n,r,i,o,a,l,s,c,u,d,f,h,p,m,g,v,y,b=e[0].name+"",w=e[0].description+"";return r=new At({props:{type:e[0].type}}),s=new Ht({props:{checked:!e[0].disabled}}),s.$on("click",e[4]),{c(){t=T("div"),n=T("div"),Ce(r.$$.fragment),i=A(),o=T("div"),a=$(b),l=A(),Ce(s.$$.fragment),c=A(),u=T("div"),d=$(w),H(o,"class","item__title svelte-15sn65u"),H(n,"class","item__header svelte-15sn65u"),H(u,"class","item__description svelte-15sn65u"),H(t,"class",f="item "+(e[0].class||"")+" svelte-15sn65u"),H(t,"data-filename",h=e[0].filename),H(t,"data-last-modified",p=e[0].lastModified),H(t,"data-type",m=e[0].type),_(t,"active",e[0].active),_(t,"disabled",e[0].disabled)},m(f,h){L(f,t,h),S(t,n),Se(r,n,null),S(n,i),S(n,o),S(o,a),S(n,l),Se(s,n,null),S(t,c),S(t,u),S(u,d),e[5](t),g=!0,v||(y=N(t,"click",e[3]),v=!0)},p(e,[n]){const i={};1&n&&(i.type=e[0].type),r.$set(i),(!g||1&n)&&b!==(b=e[0].name+"")&&z(a,b);const o={};1&n&&(o.checked=!e[0].disabled),s.$set(o),(!g||1&n)&&w!==(w=e[0].description+"")&&z(d,w),(!g||1&n&&f!==(f="item "+(e[0].class||"")+" svelte-15sn65u"))&&H(t,"class",f),(!g||1&n&&h!==(h=e[0].filename))&&H(t,"data-filename",h),(!g||1&n&&p!==(p=e[0].lastModified))&&H(t,"data-last-modified",p),(!g||1&n&&m!==(m=e[0].type))&&H(t,"data-type",m),1&n&&_(t,"active",e[0].active),1&n&&_(t,"disabled",e[0].disabled)},i(e){g||(me(r.$$.fragment,e),me(s.$$.fragment,e),g=!0)},o(e){ge(r.$$.fragment,e),ge(s.$$.fragment,e),g=!1},d(n){n&&M(t),Le(r),Le(s),e[5](null),v=!1,y()}}}function Pt(e,t,n){let r,{data:i={}}=t;function o(e,t){if(e.preventDefault(),t.temp)return;r.querySelector("input").disabled=!0;const n={filename:t.filename,action:t.disabled?"enable":"disable"};safari.extension.dispatchMessage("REQ_TOGGLE_FILE",n)}return e.$$set=e=>{"data"in e&&n(0,i=e.data)},[i,r,o,function(t){q(e,t)},e=>o(e,i),function(e){Y[e?"unshift":"push"](()=>{r=e,n(1,r)})}]}class Dt extends Te{constructor(e){super(),Me(this,e,Pt,zt,p,{data:0})}}function It(e,t,n){const r=e.slice();return r[16]=t[n],r}function _t(e){let t,n,r,i,o,a,l;return{c(){t=T("li"),t.textContent="New CSS",n=A(),r=T("li"),r.textContent="New Javascript",i=A(),o=T("li"),o.textContent="New Remote"},m(s,c){L(s,t,c),L(s,n,c),L(s,r,c),L(s,i,c),L(s,o,c),a||(l=[N(t,"click",e[10]),N(r,"click",e[11]),N(o,"click",e[7])],a=!0)},p:s,d(e){e&&M(t),e&&M(n),e&&M(r),e&&M(i),e&&M(o),a=!1,f(l)}}}function Wt(e){let t,n;return t=new Mt({}),{c(){Ce(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Le(t,e)}}}function Ft(e,t){let n,r,i,o;function a(...e){return t[12](t[16],...e)}var l=Dt;function s(e){return{props:{data:e[16]}}}return l&&(r=new l(s(t)),r.$on("click",a)),{key:e,first:null,c(){n=O(),r&&Ce(r.$$.fragment),i=O(),this.first=n},m(e,t){L(e,n,t),r&&Se(r,e,t),L(e,i,t),o=!0},p(e,n){t=e;const o={};if(8&n&&(o.data=t[16]),l!==(l=Dt)){if(r){he();const e=r;ge(e.$$.fragment,1,0,()=>{Le(e,1)}),pe()}l?(r=new l(s(t)),r.$on("click",a),Ce(r.$$.fragment),me(r.$$.fragment,1),Se(r,i.parentNode,i)):r=null}else l&&r.$set(o)},i(e){o||(r&&me(r.$$.fragment,e),o=!0)},o(e){r&&ge(r.$$.fragment,e),o=!1},d(e){e&&M(n),e&&M(i),r&&Le(r,e)}}}function Rt(e){let t,n,r,i,o,a=e[3].length+"";return{c(){t=T("div"),n=$(a),r=$(" Items"),H(t,"class","sidebar__count svelte-11mx0re")},m(e,i){L(e,t,i),S(t,n),S(t,r),o=!0},p(e,t){(!o||8&t)&&a!==(a=e[3].length+"")&&z(n,a)},i(e){o||(re(()=>{i||(i=we(t,Ne,{duration:150},!0)),i.run(1)}),o=!0)},o(e){i||(i=we(t,Ne,{duration:150},!1)),i.run(0),o=!1},d(e){e&&M(t),e&&i&&i.end()}}}function Bt(e){let t,n,r,i,o,a,l,s,c,u,d,f,h,p,m,g,v=e[2].includes("items-loading"),y=[],b=new Map;i=new Ct({}),a=new je({props:{icon:' ',title:"Open settings",disabled:e[1]}}),a.$on("click",e[9]),s=new yt({props:{icon:' ',title:"New item",disabled:e[1],$$slots:{default:[_t]},$$scope:{ctx:e}}});let w=v&&Wt(),x=e[3];const k=e=>e[16].filename;for(let t=0;t{w=null}),pe()),72&n){const t=e[3];he(),y=ke(y,n,k,1,e,t,b,u,xe,Ft,null,It),pe()}e[0]?C?(C.p(e,n),1&n&&me(C,1)):(C=Rt(e),C.c(),me(C,1),C.m(t,null)):C&&(he(),ge(C,1,1,()=>{C=null}),pe()),(!p||16&n&&h!==(h="sidebar "+(e[4].descriptions?"":"sidebar--compact")+" svelte-11mx0re"))&&H(t,"class",h)},i(e){if(!p){me(i.$$.fragment,e),me(a.$$.fragment,e),me(s.$$.fragment,e),me(w);for(let e=0;ee.temp);if((tt()||o)&&!Vt())return;nt(null),rt(null),o&&We.update(e=>e.filter(e=>!e.temp));const a=("js"===t?"NewScript-":"NewStyle-")+e(),l=a+"."+t,c="This is your new file, start writing code",u={content:n||r(c,a,t),description:c,disabled:!1,filename:l,lastModified:Date.now(),name:a,temp:!0,type:t};i&&(u.remote=i),We.update(e=>[u,...e]),await ne(),d(u)}async function d(e){if(!l.includes("ready")||e.active)return;const t=s.find(e=>e.temp);if((t&&t!=e||tt())&&!Vt())return;const n=s.find(e=>e.active);n&&(n.active=!1,We.set(s)),t&&t!=e&&We.update(e=>e.filter(e=>!e.temp));const r=e.temp?null:e.content,i=e.temp?e.content:null;nt(r),rt(i),e.active=!0,We.set(s),await ne();const o=it(),a="js"===e.type?"javascript":e.type;o.setOption("mode",a),o.setValue(e.content),o.clearHistory(),o.focus()}m(i,_e,e=>a(2,l=e)),m(i,We,e=>a(14,s=e)),m(i,Ie,e=>a(4,c=e));let f=null,h=!0;let p,g;return i.$$.update=()=>{var e,t;if(4&i.$$.dirty&&a(1,p=!l.includes("ready")),16400&i.$$.dirty&&a(3,g=(e=s,t=c.sortOrder,"nameAsc"===t?e.sort((e,t)=>e.name.localeCompare(t.name)):"nameDesc"===t?e.sort((e,t)=>t.name.localeCompare(e.name)):"lastModifiedAsc"===t?e.sort((e,t)=>e.lastModifiede.lastModified>t.lastModified?-1:1),e).filter(e=>0!=e.visible)),8&i.$$.dirty&&g.find(e=>e.active)){!async function(e){await ne(),document.querySelector(`[data-filename="${e}"]`).scrollIntoView({behavior:"auto",block:"nearest",inline:"start"})}(g.find(e=>e.active).filename)}},[h,p,l,g,c,u,d,async function(){const e=prompt("Enter remote url:");if(!e)return;if(!n(e))return Pe.add("Can't add remote file, invalid url!","error",!0);_e.add("fetching");const r=await t(e);if(r.error)Pe.add(r.error,"error",!0);else if(r.contents){u(e.substring(e.lastIndexOf(".")+1),r.contents,e)}_e.remove("fetching")},function(){f&&clearTimeout(f),a(0,h=!1),f=setTimeout(()=>a(0,h=!0),750)},()=>_e.add("settings"),()=>u("css"),()=>u("js"),e=>d(e)]}class Ut extends Te{constructor(e){super(),Me(this,e,jt,Bt,p,{})}}function Gt(e){let t,n;return t=new Mt({}),{c(){Ce(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Le(t,e)}}}function Kt(e){let t;return{c(){t=T("div"),t.textContent="No Item Selected",H(t,"class","editor__empty svelte-cjsheo")},m(e,n){L(e,t,n)},d(e){e&&M(t)}}}function qt(e){let t,n;return{c(){t=$("Last modified: "),n=$(e[3])},m(e,r){L(e,t,r),L(e,n,r)},p(e,t){8&t&&z(n,e[3])},d(e){e&&M(t),e&&M(n)}}}function Xt(e){let t;return{c(){t=$("Ready for code!")},m(e,n){L(e,t,n)},p:s,d(e){e&&M(t)}}}function Yt(e){let t,n,r,i;return{c(){t=$("Code was "),n=T("span"),r=$("remotely fetched"),i=$(", check carefully before saving!"),H(n,"class","info svelte-cjsheo"),H(n,"title",e[4])},m(e,o){L(e,t,o),L(e,n,o),S(n,r),L(e,i,o)},p(e,t){16&t&&H(n,"title",e[4])},d(e){e&&M(t),e&&M(n),e&&M(i)}}}function Qt(e){let t,n,r,i;return{c(){t=$("Updating code, "),n=T("span"),n.textContent="cancel request",H(n,"class","link")},m(o,a){L(o,t,a),L(o,n,a),r||(i=N(n,"click",e[16]),r=!0)},p:s,d(e){e&&M(t),e&&M(n),r=!1,i()}}}function Zt(e){let t;return{c(){t=$("(◞‸◟)")},m(e,n){L(e,t,n)},p:s,d(e){e&&M(t)}}}function Jt(e){let t;return{c(){t=$("Saving...")},m(e,n){L(e,t,n)},p:s,d(e){e&&M(t)}}}function en(e){let t,n,r,i,o,a,l,s,c,u,d,h,p,m,g,v,y,b,w,x,k,C,O,E,P,D,I,_,W,F,R,B,V,j,U,G=e[10].includes("editor-loading")||e[10].includes("fetching"),K=G&&Gt(),q=!e[11]&&Kt();function X(e,t){return(null==h||1024&t)&&(h=!!e[10].includes("saving")),h?Jt:((null==p||1024&t)&&(p=!!e[10].includes("trashing")),p?Zt:((null==m||1024&t)&&(m=!!e[10].includes("updating")),m?Qt:e[4]?Yt:e[5]?Xt:qt))}a=new At({props:{type:e[2]}});let Y=X(e,-1),Q=Y(e);v=new je({props:{icon:' ',title:"Check for updates",disabled:e[9]||!e[0]}}),v.$on("click",e[15]),b=new je({props:{icon:' ',title:"Download file",disabled:e[9]}}),b.$on("click",e[14]),x=new je({props:{icon:' ',title:"Trash file",disabled:e[9]}}),x.$on("click",e[17]);let Z={saveHandler:e[12]};return O=new ut({props:Z}),e[19](O),O.$on("message",e[18]),{c(){t=T("div"),K&&K.c(),n=A(),q&&q.c(),r=A(),i=T("div"),o=T("div"),Ce(a.$$.fragment),l=A(),s=T("div"),c=$(e[1]),u=A(),d=T("div"),Q.c(),g=A(),Ce(v.$$.fragment),y=A(),Ce(b.$$.fragment),w=A(),Ce(x.$$.fragment),k=A(),C=T("div"),Ce(O.$$.fragment),E=A(),P=T("div"),D=T("button"),I=$("Discard"),W=A(),F=T("button"),R=$("Save"),H(s,"class","editor__title truncate svelte-cjsheo"),H(d,"class","editor__status svelte-cjsheo"),H(o,"class","editor__header__content svelte-cjsheo"),H(i,"class","editor__header svelte-cjsheo"),H(C,"class","editor__code svelte-cjsheo"),D.disabled=_=e[9]||e[7],H(D,"class","svelte-cjsheo"),F.disabled=B=e[9]||e[8],H(F,"class","svelte-cjsheo"),H(P,"class","editor__footer svelte-cjsheo"),H(t,"class","editor svelte-cjsheo")},m(f,h){L(f,t,h),K&&K.m(t,null),S(t,n),q&&q.m(t,null),S(t,r),S(t,i),S(i,o),Se(a,o,null),S(o,l),S(o,s),S(s,c),S(o,u),S(o,d),Q.m(d,null),S(i,g),Se(v,i,null),S(i,y),Se(b,i,null),S(i,w),Se(x,i,null),S(t,k),S(t,C),Se(O,C,null),S(t,E),S(t,P),S(P,D),S(D,I),S(P,W),S(P,F),S(F,R),V=!0,j||(U=[N(D,"click",e[13]),N(F,"click",e[12])],j=!0)},p(e,[i]){1024&i&&(G=e[10].includes("editor-loading")||e[10].includes("fetching")),G?K?1024&i&&me(K,1):(K=Gt(),K.c(),me(K,1),K.m(t,n)):K&&(he(),ge(K,1,1,()=>{K=null}),pe()),e[11]?q&&(q.d(1),q=null):q||(q=Kt(),q.c(),q.m(t,r));const o={};4&i&&(o.type=e[2]),a.$set(o),(!V||2&i)&&z(c,e[1]),Y===(Y=X(e,i))&&Q?Q.p(e,i):(Q.d(1),Q=Y(e),Q&&(Q.c(),Q.m(d,null)));const l={};513&i&&(l.disabled=e[9]||!e[0]),v.$set(l);const s={};512&i&&(s.disabled=e[9]),b.$set(s);const u={};512&i&&(u.disabled=e[9]),x.$set(u);O.$set({}),(!V||640&i&&_!==(_=e[9]||e[7]))&&(D.disabled=_),(!V||768&i&&B!==(B=e[9]||e[8]))&&(F.disabled=B)},i(e){V||(me(K),me(a.$$.fragment,e),me(v.$$.fragment,e),me(b.$$.fragment,e),me(x.$$.fragment,e),me(O.$$.fragment,e),V=!0)},o(e){ge(K),ge(a.$$.fragment,e),ge(v.$$.fragment,e),ge(b.$$.fragment,e),ge(x.$$.fragment,e),ge(O.$$.fragment,e),V=!1},d(n){n&&M(t),K&&K.d(),q&&q.d(),Le(a),Q.d(),Le(v),Le(b),Le(x),e[19](null),Le(O),j=!1,f(U)}}}function tn(e,r,o){let a,l,s,c,u,d,f,h,p;m(e,_e,e=>o(10,a=e)),m(e,We,e=>o(21,l=e));let g,v=!0,y=!0;function b(e,t){o(7,v=e),o(8,y=t)}let w,x;return e.$$.update=()=>{1024&e.$$.dirty&&o(9,w=!a.includes("ready")),2097152&e.$$.dirty&&o(11,x=l.find(e=>e.active)),2144&e.$$.dirty&&x&&(it()||p.init(),o(3,d=function(e){const t=new Date(e),n=new Intl.DateTimeFormat("en",{year:"numeric"}).format(t);return`${new Intl.DateTimeFormat("en",{month:"short"}).format(t)} ${new Intl.DateTimeFormat("en",{day:"2-digit"}).format(t)}, ${n} at ${t.getHours()}:${t.getMinutes()}`}(x.lastModified)),o(1,c=x.name),o(4,f=x.remote),o(5,h=x.temp),o(2,u=x.type),o(0,s=x.canUpdate),b(!0,!h))},[s,c,u,d,f,h,p,v,y,w,a,x,function(){if(!a.includes("ready")||!tt()&&!x.temp)return;_e.add("saving");const e={current:x,new:p.getValue()};safari.extension.dispatchMessage("REQ_FILE_SAVE",e)},()=>p.discardChanges(),function(){const e=document.createElement("a"),t=p.getValue(),n=x.filename;e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),e.setAttribute("download",n),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)},async function(){const e=i(p.getValue()),r="Update failed, metadata missing!",o="Update failed, version value required!",a="Update failed, update url required!",l="Update failed, invalid update url!",s="Update failed, invalid download url!",c="Update failed, updateURL unreachable!",u="Update failed, couldn't parse remote version!",d="No updates found!",f="Update failed, downloadURL unreachable!";if(!e||!e.metadata)return Pe.add(r,"error",!0);const h=e.metadata;if(!h.version)return Pe.add(o,"error",!0);if(!h.updateURL)return Pe.add(a,"error",!0);const m=h.updateURL[0],v=h.downloadURL?h.downloadURL[0]:m,y=h.version[0];if(!n(m))return Pe.add(l,"error",!0);if(!n(v))return Pe.add(s,"error",!0);g=new AbortController;const w=g.signal;_e.add("updating");const x=await t(m,w);if(x.error)return _e.remove("updating"),Pe.add(c,"error",!0);let k=x.contents;const C=i(x.contents);if(!C||!C.metadata||!C.metadata.version)return _e.remove("updating"),Pe.add(u,"error",!0);if(y>=C.metadata.version)return _e.remove("updating"),Pe.add(d,"info",!0);if(m!=v){const e=await t(v,w);if(e.error)return _e.remove("updating"),Pe.add(f,"error",!0);k=e.contents}it().setValue(k),b(!1,!1),Pe.add("Successfully updated code, review it and save!","warn",!0),_e.remove("updating")},function(){g.abort(),Pe.add("Update aborted!","info",!0),_e.remove("updating")},function(){const e=x.filename,t=x.temp;if(confirm("Are you sure you want to trash this file?"))if(_e.add("trashing"),t)We.update(e=>e.filter(e=>!e.active)),_e.remove("trashing");else{const t={filename:e};safari.extension.dispatchMessage("REQ_FILE_TRASH",t)}},function(e){const t=e.detail.name;"enableButtons"!==t||h?"disableButtons"!==t||h||b(!0,!0):b(!1,!1)},function(e){Y[e?"unshift":"push"](()=>{p=e,o(6,p)})}]}class nn extends Te{constructor(e){super(),Me(this,e,tn,en,p,{})}}function rn(e){let t,n;return{c(){n=O(),t=new F(n)},m(e,r){t.m(St,e,r),L(e,n,r)},p:s,d(e){e&&M(n),e&&t.d()}}}function on(e){let t,n,r,i,o,a,l,s,c,u,d,h,p,m,g,v,y,b,w,x,k,C,O,E,P,D,_,W,F,R,B,V,j,U,G,K,q,X,Y,Q,Z,J,ee,te,ne,ie,oe,ae,le,se,ce,ue,de,fe,he,pe,ve,we,xe,ke,Me,Te,$e,Ae,Oe,He,ze,Pe,De,Ie,_e,We,Fe,Re,Be,Ve,Ge,Ke,qe,Xe,Ye,Qe,Ze,Je=e[3].saveLocation+"",et=e[3].version+"";l=new je({props:{icon:Ue}}),l.$on("click",e[7]),h=new Ht({props:{checked:e[3].autoHint}}),h.$on("click",e[8]),y=new Ht({props:{checked:!e[3].descriptions}}),y.$on("click",e[9]),C=new Ht({props:{checked:e[3].showInvisibles}}),C.$on("click",e[10]),_=new Ht({props:{checked:e[3].lint}}),_.$on("click",e[11]),J=new Ht({props:{checked:e[3].log}}),J.$on("click",e[14]),se=new je({props:{icon:' ',title:"Change save location"}}),se.$on("click",ln);let tt=e[1]&&rn();return{c(){t=T("div"),n=T("div"),r=T("div"),i=T("div"),o=T("div"),o.textContent="Editor Settings",a=A(),Ce(l.$$.fragment),s=A(),c=T("div"),u=T("div"),u.textContent="Auto Hint",d=A(),Ce(h.$$.fragment),p=A(),m=T("div"),g=T("div"),g.textContent="Hide Descriptions",v=A(),Ce(y.$$.fragment),b=A(),w=T("div"),x=T("div"),x.textContent="Show Invisibles",k=A(),Ce(C.$$.fragment),O=A(),E=T("div"),P=T("div"),P.textContent="Javascript Linter",D=A(),Ce(_.$$.fragment),W=A(),F=T("div"),R=T("div"),R.textContent="Tab Size",B=A(),V=T("select"),j=T("option"),j.textContent="2",U=T("option"),U.textContent="4",G=A(),K=T("div"),q=T("div"),q.innerHTML='General Settings
',X=A(),Y=T("div"),Q=T("div"),Q.textContent="Log Activity",Z=A(),Ce(J.$$.fragment),ee=A(),te=T("div"),ne=T("div"),ne.textContent="Save Location",ie=A(),oe=T("div"),ae=$(Je),le=A(),Ce(se.$$.fragment),ce=A(),ue=T("div"),de=T("div"),fe=T("span"),fe.textContent="Global Blacklist",he=A(),tt&&tt.c(),pe=A(),ve=T("textarea"),xe=A(),ke=T("div"),Me=T("div"),Me.textContent="Information",Te=A(),$e=T("p"),Ae=$("Version "),Oe=$(et),He=T("br"),ze=T("br"),Pe=$("You can review the documentation, report bugs and get more information about this extension by visiting "),De=T("a"),De.textContent="the code repository.",Ie=T("br"),_e=T("br"),We=$("If you enjoy using this extension, please consider "),Fe=T("a"),Fe.textContent="leaving a review",Re=$(" on the App Store or "),Be=T("a"),Be.textContent="supporting the project",Ve=$("."),H(o,"class","svelte-1nom7cs"),H(i,"class","modal__title svelte-1nom7cs"),H(u,"class","svelte-1nom7cs"),H(c,"class","modal__row svelte-1nom7cs"),H(g,"class","svelte-1nom7cs"),H(m,"class","modal__row svelte-1nom7cs"),H(x,"class","svelte-1nom7cs"),H(w,"class","modal__row svelte-1nom7cs"),H(P,"class","svelte-1nom7cs"),H(E,"class","modal__row svelte-1nom7cs"),H(R,"class","svelte-1nom7cs"),j.__value="2",j.value=j.__value,U.__value="4",U.value=U.__value,void 0===e[3].tabSize&&re(()=>e[12].call(V)),H(F,"class","modal__row svelte-1nom7cs"),H(r,"class","modal__section"),H(q,"class","modal__title svelte-1nom7cs"),H(Q,"class","svelte-1nom7cs"),H(Y,"class","modal__row svelte-1nom7cs"),H(ne,"class","svelte-1nom7cs"),H(oe,"class","saveLocation truncate svelte-1nom7cs"),H(te,"class","modal__row svelte-1nom7cs"),H(de,"class","blacklist svelte-1nom7cs"),H(ve,"placeholder","Comma separated domain patterns"),H(ve,"spellcheck","false"),ve.value=e[2],ve.disabled=we=e[4].includes("blacklist-saving")||e[1],H(ve,"class","svelte-1nom7cs"),H(ue,"class","modal__row modal__row--wrap svelte-1nom7cs"),H(K,"class","modal__section"),H(Me,"class","modal__title modal__title--borderless svelte-1nom7cs"),H(De,"href","https://github.com/quoid/userscripts"),H(Fe,"href","https://apps.apple.com/us/app/userscripts/id1463298887"),H(Be,"href","https://github.com/quoid/userscripts#support-development"),H($e,"class","svelte-1nom7cs"),H(ke,"class","modal__section"),H(n,"class","modal svelte-1nom7cs"),H(t,"class","settings svelte-1nom7cs")},m(f,M){var T;L(f,t,M),S(t,n),S(n,r),S(r,i),S(i,o),S(i,a),Se(l,i,null),S(r,s),S(r,c),S(c,u),S(c,d),Se(h,c,null),S(r,p),S(r,m),S(m,g),S(m,v),Se(y,m,null),S(r,b),S(r,w),S(w,x),S(w,k),Se(C,w,null),S(r,O),S(r,E),S(E,P),S(E,D),Se(_,E,null),S(r,W),S(r,F),S(F,R),S(F,B),S(F,V),S(V,j),S(V,U),I(V,e[3].tabSize),S(n,G),S(n,K),S(K,q),S(K,X),S(K,Y),S(Y,Q),S(Y,Z),Se(J,Y,null),S(K,ee),S(K,te),S(te,ne),S(te,ie),S(te,oe),S(oe,ae),S(te,le),Se(se,te,null),S(K,ce),S(K,ue),S(ue,de),S(de,fe),S(de,he),tt&&tt.m(de,null),S(ue,pe),S(ue,ve),e[15](ve),S(n,xe),S(n,ke),S(ke,Me),S(ke,Te),S(ke,$e),S($e,Ae),S($e,Oe),S($e,He),S($e,ze),S($e,Pe),S($e,De),S($e,Ie),S($e,_e),S($e,We),S($e,Fe),S($e,Re),S($e,Be),S($e,Ve),Ye=!0,Qe||(Ze=[N(V,"change",e[12]),N(V,"blur",e[13]),N(oe,"click",an),N(ve,"blur",e[5]),N(t,"click",(T=e[16],function(e){e.target===this&&T.call(this,e)}))],Qe=!0)},p(e,[t]){const n={};8&t&&(n.checked=e[3].autoHint),h.$set(n);const r={};8&t&&(r.checked=!e[3].descriptions),y.$set(r);const i={};8&t&&(i.checked=e[3].showInvisibles),C.$set(i);const o={};8&t&&(o.checked=e[3].lint),_.$set(o),8&t&&I(V,e[3].tabSize);const a={};8&t&&(a.checked=e[3].log),J.$set(a),(!Ye||8&t)&&Je!==(Je=e[3].saveLocation+"")&&z(ae,Je),e[1]?tt?tt.p(e,t):(tt=rn(),tt.c(),tt.m(de,null)):tt&&(tt.d(1),tt=null),(!Ye||4&t)&&(ve.value=e[2]),(!Ye||18&t&&we!==(we=e[4].includes("blacklist-saving")||e[1]))&&(ve.disabled=we),(!Ye||8&t)&&et!==(et=e[3].version+"")&&z(Oe,et)},i(e){Ye||(me(l.$$.fragment,e),me(h.$$.fragment,e),me(y.$$.fragment,e),me(C.$$.fragment,e),me(_.$$.fragment,e),me(J.$$.fragment,e),me(se.$$.fragment,e),re(()=>{Ke&&Ke.end(1),Ge||(Ge=ye(n,Ee,{y:50,duration:150,delay:75})),Ge.start()}),re(()=>{Xe&&Xe.end(1),qe||(qe=ye(t,Ne,{duration:150})),qe.start()}),Ye=!0)},o(e){ge(l.$$.fragment,e),ge(h.$$.fragment,e),ge(y.$$.fragment,e),ge(C.$$.fragment,e),ge(_.$$.fragment,e),ge(J.$$.fragment,e),ge(se.$$.fragment,e),Ge&&Ge.invalidate(),Ke=be(n,Ee,{y:50,duration:150,delay:0}),qe&&qe.invalidate(),Xe=be(t,Ne,{duration:150,delay:75}),Ye=!1},d(n){n&&M(t),Le(l),Le(h),Le(y),Le(C),Le(_),Le(J),Le(se),tt&&tt.d(),e[15](null),n&&Ke&&Ke.end(),n&&Xe&&Xe.end(),Qe=!1,f(Ze)}}}function an(){safari.extension.dispatchMessage("REQ_OPEN_SAVE_LOCATION")}function ln(){confirm("Changing the save location requires all instances of the extension to be closed and the host application to be opened. This will be automatically attempted.\n\nDo you wish to continue?")&&(window.open("userscriptsurlscheme:changesavelocation"),safari.extension.dispatchMessage("REQ_CHANGE_SAVE_LOCATION"))}function sn(e,t,n){let r,i,o;m(e,Ie,e=>n(3,r=e)),m(e,_e,e=>n(4,i=e));let a=!1;function l(e,t){Ie.updateSingleSetting(e,t)}let s;return e.$$.update=()=>{8&e.$$.dirty&&n(2,s=r.blacklist.join(", "))},[o,a,s,r,i,function(){const e=o.value.split(",").map(e=>e.trim()).filter(e=>e);[...e].sort().toString()!=[...r.blacklist].sort().toString()&&(Ie.updateSingleSetting("blacklist",e),n(1,a=!0),setTimeout(()=>n(1,a=!1),1e3))},l,()=>_e.remove("settings"),()=>l("autoHint",!r.autoHint),()=>l("descriptions",!r.descriptions),()=>l("showInvisibles",!r.showInvisibles),()=>l("lint",!r.lint),function(){r.tabSize=function(e){const t=e.querySelector(":checked")||e.options[0];return t&&t.__value}(this),Ie.set(r)},()=>l("tabSize",r.tabSize),()=>l("log",!r.log),function(e){Y[e?"unshift":"push"](()=>{o=e,n(0,o)})},()=>{_e.remove("settings")}]}class cn extends Te{constructor(e){super(),Me(this,e,sn,on,p,{})}}function un(e,t,n){const r=e.slice();return r[7]=t[n],r}function dn(e){let t,n,r,i,o,a;function l(e,t){return(null==i||1&t)&&(i=!!e[0].includes("init-error")),i?hn:fn}let s=l(e,-1),c=s(e);return{c(){t=T("div"),r=A(),c.c(),n=new F(r),H(t,"class","initializer svelte-17m9goi")},m(e,i){L(e,t,i),n.m(' ',t),S(t,r),c.m(t,null),a=!0},p(e,n){s!==(s=l(e,n))&&(c.d(1),c=s(e),c&&(c.c(),c.m(t,null)))},i(e){a||(o&&o.end(1),a=!0)},o(e){o=be(t,Oe,{duration:350}),a=!1},d(e){e&&M(t),c.d(),e&&o&&o.end()}}}function fn(e){let t;return{c(){t=T("span"),t.textContent="Initializing app...",H(t,"class","svelte-17m9goi")},m(e,n){L(e,t,n)},d(e){e&&M(t)}}}function hn(e){let t;return{c(){t=T("span"),t.textContent="Failed to initialize app, check the console!",H(t,"class","svelte-17m9goi")},m(e,n){L(e,t,n)},d(e){e&&M(t)}}}function pn(e,t){let n,r,i;return r=new mt({props:{item:t[7]}}),r.$on("click",(function(...e){return t[3](t[7],...e)})),{key:e,first:null,c(){n=O(),Ce(r.$$.fragment),this.first=n},m(e,t){L(e,n,t),Se(r,e,t),i=!0},p(e,n){t=e;const i={};2&n&&(i.item=t[7]),r.$set(i)},i(e){i||(me(r.$$.fragment,e),i=!0)},o(e){ge(r.$$.fragment,e),i=!1},d(e){e&&M(n),Le(r,e)}}}function mn(e){let t,n;return t=new cn({}),{c(){Ce(t.$$.fragment)},m(e,r){Se(t,e,r),n=!0},i(e){n||(me(t.$$.fragment,e),n=!0)},o(e){ge(t.$$.fragment,e),n=!1},d(e){Le(t,e)}}}function gn(e){let t,n,r,i,o,a,l,s,c,u,d,h,p=e[0].includes("init"),m=[],g=new Map,v=e[0].includes("settings"),y=p&&dn(e);r=new Ut({}),o=new nn({});let b=e[1];const w=e=>e[7].id;for(let t=0;t{y=null}),pe()),2&n){const t=e[1];he(),m=ke(m,n,w,1,e,t,g,l,xe,pn,null,un),pe()}1&n&&(v=e[0].includes("settings")),v?x?1&n&&me(x,1):(x=mn(),x.c(),me(x,1),x.m(c.parentNode,c)):x&&(he(),ge(x,1,1,()=>{x=null}),pe())},i(e){if(!u){me(y),me(r.$$.fragment,e),me(o.$$.fragment,e);for(let e=0;en(4,r=e)),m(e,Ie,e=>n(5,i=e)),m(e,_e,e=>n(0,o=e)),m(e,De,e=>n(1,a=e));let l=[];var s;s=()=>{dt?safari.self.addEventListener("message",e=>ft(e)):(window.addEventListener("customEvent",e=>ft(e)),_safari||alert("Failed to initialize, ensure Safari is version 13 or higher!")),safari.extension.dispatchMessage("REQ_INIT_DATA")},K().$$.on_mount.push(s);return e.$$.update=()=>{48&e.$$.dirty&&r.some(e=>{l.includes(e)||(i.log&&console[e.type](e.message),l.push(e))})},[o,a,async function(){document.documentElement.style.height="100vh",await ne(),document.documentElement.removeAttribute("style")},e=>De.remove(e.id)]}new class extends Te{constructor(e){super(),Me(this,e,yn,gn,p,{})}}({target:document.getElementById("app"),props:{}})}()