text: (window.webpackJsonp=window.webpackJsonp||[]).push([[7],{538:function(e,n,t){},542:function(e,n,t){"use strict";t.r(n);var a=t(1),i=t.n(a),s=t(58),c=t.n(s),r=t(3),o=t(437),l=t(64),d=(t(538),t(201)),p=t(16),u=t(4),g=t(194);var f=function(e){t.e(6).then(t.bind(null,553)).then((function(n){(0,n.default)(e)}))},v=t(11),m=t(202);n.default=function(e){var n=i()("span",{className:"icon search",attr:{action:"search"}}),t=i()("span",{className:"icon more_vert",attr:{action:"toggle-menu"}}),a=Object(l.a)("Gists"),s=r.a.credentials,h=null,b=g.a.GitHub(),w=b.getUser(),y=cordova.file.externalDataDirectory+".gists",k=Object(d.a)(c.a.render('<li action="create">\n  <span class="text">new gist</span>\n  <span class="icon add"></span>\n</li>\n<li action="reload">\n  <span class="text">{{reload}}</span>\n  <span class="icon refresh"></span>\n</li>',strings),{top:"8px",right:"8px",toggle:t,transformOrigin:"top right"});function S(n){var t=a.querySelector("#gists");t&&t.remove(),(h=e?e(n):n).map((function(e){var n=Object.values(e.files),t=n.length>0?n[0].filename:e.id;e.private=!e.public,e.name=t,e.files_count=n.length}));var s=i.a.parse(c.a.render('<div class="main list" empty-msg="{{msg}}" id="gists">{{#gists}}\n  <div class="list-item" action="gist" data-url="{{html_url}}" owner="{{owner.login}}" name="{{name}}" id="{{id}}">\n    <span class="octicon main-icon" {{#private}}private{{/private}}></span>\n    <div class="container">\n      <div class="text">\n        <span>{{name}}</span>\n      </div>\n      <small class="value">\n        <div class="group">\n          <span class="octicon octicon-file-code"></span>\n          <span class="text">{{files_count}}</span>\n        </div>\n        <div class="group">\n          <span class="octicon octicon-comment"></span>\n          <span class="text">{{comments}}</span>\n        </div>\n      </small>\n    </div>\n    <span class="icon open_in_browser" action="open"></span>\n  </div>\n  {{/gists}}</div>',{gists:h,msg:strings["empty folder message"]}));s.addEventListener("click",x),a.append(s),a.isConnected||(app.appendChild(a),actionStack.push({id:"repos",action:a.hide}),a.onhide=function(){actionStack.remove("repos")})}function x(e){var n,t,a,i=e.target,s=i.getAttribute("action");switch(["reload","create"].includes(s)&&k.hide(),s){case"gist":t=i.id,(a=gistRecord.get(t))?f(a):(u.a.loader.create("",strings.loading+"..."),b.getGist(t).read().then((function(e){var n=e.data;a=gistRecord.add(n),f(a)})).catch((function(e){e&&u.a.alert(strings.error,e.toString())})).finally((function(){u.a.loader.destroy()})));break;case"open":window.open(i.parentElement.getAttribute("data-url"),"_system");break;case"reload":_(),gistRecord.reset();break;case"share":break;case"create":n={id:parseInt(Math.random()*(new Date).getTime()).toString(16),files:{},public:!1},u.a.select("",["public","private"],{default:"priavate"}).then((function(e){return"public"===e&&(n.public=!0),u.a.prompt(strings["enter file name"],strings["new file"],"text",{match:v.a.FILE_NAME_REGEX,required:!0})})).then((function(e){var t={filename:e,content:""};n.files[e]=t;var a=gistRecord.add(n,!0);editorManager.addNewFile(e,{type:"gist",text:t.content,isUnsaved:!1,record:a,render:!0}),actionStack.pop(),actionStack.pop()}))}}function _(){u.a.loader.create("Gists",strings.loading+"..."),w.listGists().then((function(e){var n=e.data,t=s.encrypt(JSON.stringify(n));p.a.writeFile(y,t,!0,!1).catch((function(e){plugins.toast.showShortBottom(strings.error),console.log(e)})),S(n)})).catch((function(e){e.response?Object(o.a)():console.log(e)})).finally((function(){u.a.loader.destroy()}))}k.addEventListener("click",x),a.querySelector("header").append(n,t),n.onclick=function(){Object(m.a)(a.querySelector(".list"))},p.a.readFile(y).then((function(e){var n=new TextDecoder("utf-8"),t=s.decrypt(n.decode(e.data));S(JSON.parse(t))})).catch((function(e){u.a.loader.create("GitHub",strings.loading+"..."),_()}))}}}]);