diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-03-25 17:31:17 +0300 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-03-25 21:48:06 +0300 |
commit | 0d5c4e438e001ef21dfae69df4ae186b697d2efc (patch) | |
tree | 82e00390f6bac6fbcb1bb09479982167b5e792f4 | |
parent | f7520a8fe7191475668904f5f8c1816df25e2e5a (diff) |
add basic basic auth support
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | appinfo/database.xml | 12 | ||||
-rw-r--r-- | appinfo/info.xml | 2 | ||||
-rw-r--r-- | controller/feedcontroller.php | 8 | ||||
-rw-r--r-- | css/navigation.css | 12 | ||||
-rw-r--r-- | db/feed.php | 10 | ||||
-rw-r--r-- | fetcher/feedfetcher.php | 21 | ||||
-rw-r--r-- | fetcher/fetcher.php | 9 | ||||
-rw-r--r-- | fetcher/ifeedfetcher.php | 6 | ||||
-rw-r--r-- | fetcher/youtubefetcher.php | 9 | ||||
-rw-r--r-- | js/build/app.min.js | 6 | ||||
-rw-r--r-- | js/controller/NavigationController.js | 6 | ||||
-rw-r--r-- | js/gulpfile.js | 2 | ||||
-rw-r--r-- | js/service/FeedResource.js | 7 | ||||
-rw-r--r-- | js/tests/unit/controller/NavigationControllerSpec.js | 10 | ||||
-rw-r--r-- | js/tests/unit/service/FeedResourceSpec.js | 16 | ||||
-rw-r--r-- | service/feedservice.php | 16 | ||||
-rw-r--r-- | templates/part.navigation.addfeed.php | 20 | ||||
-rw-r--r-- | tests/unit/db/FeedTest.php | 6 | ||||
-rw-r--r-- | tests/unit/service/FeedServiceTest.php | 7 |
20 files changed, 155 insertions, 31 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a8932b21e..e1446b487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ owncloud-news (7.2.0) * **New dependency**: Bump required PostgreSQL version to 9.4 * **New dependency**: Bump required MySql/MariaDB version to 5.5 * **Bugfix**: Fix bug that would not lowercase non ASCII characters when searching, #944 +* **Enhancement**: Add HTTP basic auth, #938 owncloud-news (7.1.2) * **Enhancement**: Major JavaScript library updates: diff --git a/appinfo/database.xml b/appinfo/database.xml index a831b4211..9b6b36a3d 100644 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -154,6 +154,18 @@ <notnull>false</notnull> </field> <field> + <name>basic_auth_user</name> + <type>clob</type> + <default></default> + <notnull>false</notnull> + </field> + <field> + <name>basic_auth_password</name> + <type>clob</type> + <default></default> + <notnull>false</notnull> + </field> + <field> <name>deleted_at</name> <type>integer</type> <default>0</default> diff --git a/appinfo/info.xml b/appinfo/info.xml index cb58ef86b..38fd91fef 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -7,7 +7,7 @@ <author>Bernhard Posselt, Alessandro Cosentino, Jan-Christoph Borchardt</author> <category>multimedia</category> <licence>AGPL</licence> - <version>7.1.2</version> + <version>7.1.3</version> <namespace>News</namespace> <!-- resources --> diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php index 37e415661..2b95794a3 100644 --- a/controller/feedcontroller.php +++ b/controller/feedcontroller.php @@ -124,16 +124,20 @@ class FeedController extends Controller { * @param string $url * @param int $parentFolderId * @param string $title + * @param string $user + * @param string $password * @return array|\OCP\AppFramework\Http\JSONResponse */ - public function create($url, $parentFolderId, $title){ + public function create($url, $parentFolderId, $title=null, + $user=null, $password=null){ try { // we need to purge deleted feeds if a feed is created to // prevent already exists exceptions $this->feedService->purgeDeleted($this->userId, false); $feed = $this->feedService->create($url, $parentFolderId, - $this->userId, $title); + $this->userId, $title, + $user, $password); $params = ['feeds' => [$feed]]; try { diff --git a/css/navigation.css b/css/navigation.css index 8d2d3a362..d5ea11d7f 100644 --- a/css/navigation.css +++ b/css/navigation.css @@ -76,6 +76,18 @@ margin-right: 0; } +#app-navigation .add-new-popup .add-feed-advanced { + width: 100%; +} + +#app-navigation .add-new-popup .add-feed-advanced-area { + padding: 10px 0; +} + +#app-navigation .add-new-popup .add-feed-advanced-area h2 { + font-size: 11pt; + font-weight: bold; +} #app-navigation .add-new-popup .error { padding: 0 0 10px 0; diff --git a/db/feed.php b/db/feed.php index 5e2c7fab0..f78b1f364 100644 --- a/db/feed.php +++ b/db/feed.php @@ -56,6 +56,10 @@ use \OCP\AppFramework\Db\Entity; * @method void setUpdateErrorCount(integer $value) * @method string getLastUpdateError() * @method void setLastUpdateError(string $value) + * @method string getBasicAuthUser() + * @method void setBasicAuthUser(string $value) + * @method string getBasicAuthPassword() + * @method void setBasicAuthPassword(string $value) */ class Feed extends Entity implements IAPI, \JsonSerializable { @@ -82,6 +86,8 @@ class Feed extends Entity implements IAPI, \JsonSerializable { protected $updateMode; protected $updateErrorCount; protected $lastUpdateError; + protected $basicAuthUser; + protected $basicAuthPassword; public function __construct(){ $this->addType('parentId', 'integer'); @@ -123,7 +129,9 @@ class Feed extends Entity implements IAPI, \JsonSerializable { 'pinned', 'updateMode', 'updateErrorCount', - 'lastUpdateError' + 'lastUpdateError', + 'basicAuthUser', + 'basicAuthPassword' ]); $url = parse_url($this->link)['host']; diff --git a/fetcher/feedfetcher.php b/fetcher/feedfetcher.php index 6b7460679..458f1220d 100644 --- a/fetcher/feedfetcher.php +++ b/fetcher/feedfetcher.php @@ -23,6 +23,8 @@ use PicoFeed\Client\InvalidUrlException; use PicoFeed\Client\MaxRedirectException; use PicoFeed\Client\MaxSizeException; use PicoFeed\Client\TimeoutException; +use PicoFeed\Client\ForbiddenException; +use PicoFeed\Client\UnauthorizedException; use OCP\IL10N; use OCP\AppFramework\Utility\ITimeFactory; @@ -71,14 +73,24 @@ class FeedFetcher implements IFeedFetcher { * no results are fetched * @param bool fullTextEnabled if true tells the fetcher to enhance the * articles by fetching custom enhanced content + * @param string $basicAuthUser if given, basic auth is set for this feed + * @param string $basicAuthPassword if given, basic auth is set for this + * feed. Ignored if user is null or an empty string * @throws FetcherException if it fails * @return array an array containing the new feed and its items, first * element being the Feed and second element being an array of Items */ public function fetch($url, $getFavicon=true, $lastModified=null, - $etag=null, $fullTextEnabled=false) { + $etag=null, $fullTextEnabled=false, + $basicAuthUser=null, $basicAuthPassword=null) { try { - $resource = $this->reader->discover($url, $lastModified, $etag); + if ($basicAuthUser !== null && trim($basicAuthUser) !== '') { + $resource = $this->reader->discover($url, $lastModified, $etag, + $basicAuthUser, + $basicAuthPassword); + } else { + $resource = $this->reader->discover($url, $lastModified, $etag); + } if (!$resource->isModified()) { return [null, null]; @@ -131,6 +143,11 @@ class FeedFetcher implements IFeedFetcher { $msg = $this->l10n->t('Bigger than maximum allowed size'); } else if ($ex instanceof TimeoutException) { $msg = $this->l10n->t('Request timed out'); + } else if ($ex instanceof UnauthorizedException) { + $msg = $this->l10n->t('Required credentials for feed were ' . + 'either missing or incorrect'); + } else if ($ex instanceof ForbiddenException) { + $msg = $this->l10n->t('Forbidden to access feed'); } throw new FetcherException($msg); diff --git a/fetcher/fetcher.php b/fetcher/fetcher.php index 4787ccfdd..43c9e7a3f 100644 --- a/fetcher/fetcher.php +++ b/fetcher/fetcher.php @@ -44,16 +44,21 @@ class Fetcher { * no results are fetched * @param bool fullTextEnabled if true tells the fetcher to enhance the * articles by fetching custom enhanced content + * @param string $basicAuthUser if given, basic auth is set for this feed + * @param string $basicAuthPassword if given, basic auth is set for this + * feed. Ignored if user is null or an empty string * @throws FetcherException if simple pie fails * @return array an array containing the new feed and its items, first * element being the Feed and second element being an array of Items */ public function fetch($url, $getFavicon=true, $lastModified=null, - $etag=null, $fullTextEnabled=false) { + $etag=null, $fullTextEnabled=false, + $basicAuthUser=null, $basicAuthPassword=null) { foreach($this->fetchers as $fetcher){ if($fetcher->canHandle($url)){ return $fetcher->fetch($url, $getFavicon, $lastModified, $etag, - $fullTextEnabled); + $fullTextEnabled, $basicAuthUser, + $basicAuthPassword); } } diff --git a/fetcher/ifeedfetcher.php b/fetcher/ifeedfetcher.php index 297885930..e854d83fe 100644 --- a/fetcher/ifeedfetcher.php +++ b/fetcher/ifeedfetcher.php @@ -27,12 +27,16 @@ interface IFeedFetcher { * no results are fetched * @param bool fullTextEnabled if true tells the fetcher to enhance the * articles by fetching custom enhanced content + * @param string $basicAuthUser if given, basic auth is set for this feed + * @param string $basicAuthPassword if given, basic auth is set for this + * feed. Ignored if user is null or an empty string * @throws FetcherException if the fetcher encounters a problem * @return array an array containing the new feed and its items, first * element being the Feed and second element being an array of Items */ function fetch($url, $getFavicon=true, $lastModified=null, $etag=null, - $fullTextEnabled=false); + $fullTextEnabled=false, $basicAuthUser=null, + $basicAuthPassword=null); /** * @param string $url the url that should be fetched diff --git a/fetcher/youtubefetcher.php b/fetcher/youtubefetcher.php index 35ecd80f0..3752ba197 100644 --- a/fetcher/youtubefetcher.php +++ b/fetcher/youtubefetcher.php @@ -55,16 +55,21 @@ class YoutubeFetcher implements IFeedFetcher { * no results are fetched * @param bool fullTextEnabled if true tells the fetcher to enhance the * articles by fetching custom enhanced content + * @param string $basicAuthUser if given, basic auth is set for this feed + * @param string $basicAuthPassword if given, basic auth is set for this + * feed. Ignored if user is null or an empty string * @throws FetcherException if it fails * @return array an array containing the new feed and its items, first * element being the Feed and second element being an array of Items */ public function fetch($url, $getFavicon=true, $lastModified=null, - $etag=null, $fullTextEnabled=false) { + $etag=null, $fullTextEnabled=false, + $basicAuthUser=null, $basicAuthPassword=null) { $transformedUrl = $this->buildUrl($url); $result = $this->feedFetcher->fetch( - $transformedUrl, $getFavicon, $lastModified, $etag, $fullTextEnabled + $transformedUrl, $getFavicon, $lastModified, $etag, + $fullTextEnabled, $basicAuthUser, $basicAuthPassword ); // reset feed url so we know the correct added url for the feed diff --git a/js/build/app.min.js b/js/build/app.min.js index 32ea96774..c2db1412e 100644 --- a/js/build/app.min.js +++ b/js/build/app.min.js @@ -1,3 +1,3 @@ -var app=angular.module("News",["ngRoute","ngSanitize","ngAnimate"]);app.config(["$routeProvider","$provide","$httpProvider",function(e,n,r){"use strict";var i={FEED:0,FOLDER:1,STARRED:2,SUBSCRIPTIONS:3,SHARED:4,EXPLORE:5};n.constant("REFRESH_RATE",60),n.constant("ITEM_BATCH_SIZE",40),n.constant("ITEM_AUTO_PAGE_SIZE",20),n.constant("BASE_URL",OC.generateUrl("/apps/news")),n.constant("FEED_TYPE",i),n.constant("MARK_READ_TIMEOUT",.5),n.constant("SCROLL_TIMEOUT",.1),n.factory("CSRFInterceptor",["$q","BASE_URL","$window",function(e,t,n){return{request:function(r){var i=n.location.href.split(n.location.pathname)[0];return 0!==r.url.indexOf(t)&&0!==r.url.indexOf(i)||(r.headers.requesttoken=oc_requesttoken),r||e.when(r)}}}]);var o={0:t("news","Request failed, network connection unavailable!"),401:t("news","Request unauthorized. Are you logged in?"),403:t("news","Request forbidden. Are you an admin?"),412:t("news","Token expired or app not enabled! Reload the page!"),500:t("news","Internal server error! Please check your data/owncloud.log file for additional information!"),503:t("news","Request failed, ownCloud is in currently in maintenance mode!")};n.factory("ConnectionErrorInterceptor",["$q","$timeout",function(e,t){var n;return{responseError:function(r){return r.status in o&&(n&&t.cancel(n),OC.Notification.hide(),OC.Notification.showHtml(o[r.status]),n=t(function(){OC.Notification.hide()},5e3)),e.reject(r)}}}]),r.interceptors.push("CSRFInterceptor"),r.interceptors.push("ConnectionErrorInterceptor");var s=function(e){return{data:["$http","$route","$q","$location","BASE_URL","ITEM_BATCH_SIZE","FEED_TYPE","SettingsResource","FeedResource",function(t,n,r,i,o,s,a,u,d){var c=u.get("showAll"),l=u.get("oldestFirst"),f=i.search().search||"",h=r.defer();if(null===c||null===l)h.resolve({});else{var p={type:e,limit:s,showAll:c,oldestFirst:l,search:f};if(void 0!==n.current&&void 0!==n.current.params&&void 0!==n.current.params.id&&(p.id=n.current.params.id),e===a.FEED){var g=d.getById(p.id);void 0===g||2===g.ordering?p.oldestFirst=!1:1===g.ordering&&(p.oldestFirst=!0)}t({url:o+"/items",method:"GET",params:p}).success(function(e){h.resolve(e)})}return h.promise}]}},a=function(){return{sites:["$http","$q","BASE_URL","$location","Publisher","SettingsResource",function(e,t,n,r,i,o){var s=t.defer(),a=r.search().lang;return a||(a=o.get("language")),e.get(n+"/settings").then(function(t){i.publishAll(t);var n=o.get("exploreUrl").replace(/\/+$/,""),r=n+"/feeds."+a+".json",s=n+"/feeds.en.json";return e.get(r)["catch"](function(){return e.get(s)})}).then(function(e){s.resolve(e.data)})["catch"](function(){s.reject()}),s.promise}]}};e.when("/items",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.SUBSCRIPTIONS),type:i.SUBSCRIPTIONS}).when("/items/starred",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.STARRED),type:i.STARRED}).when("/items/feeds/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.FEED),type:i.FEED}).when("/items/folders/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.FOLDER),type:i.FOLDER}).when("/explore",{controller:"ExploreController as Explore",templateUrl:"explore.html",resolve:a(),type:i.EXPLORE}).when("/shortcuts",{templateUrl:"shortcuts.html",type:-1})}]),app.run(["$rootScope","$location","$http","$q","$interval","$route","Loading","ItemResource","FeedResource","FolderResource","SettingsResource","Publisher","BASE_URL","FEED_TYPE","REFRESH_RATE",function(e,t,n,r,i,o,s,a,u,d,c,l,f,h,p){"use strict";s.setLoading("global",!0),l.subscribe(a).toChannels(["items","newestItemId","starred"]),l.subscribe(d).toChannels(["folders"]),l.subscribe(u).toChannels(["feeds"]),l.subscribe(c).toChannels(["settings"]);var g=r.defer();n.get(f+"/settings").success(function(e){l.publishAll(e),g.resolve()});var v=r.defer(),m=t.path();n.get(f+"/feeds/active").success(function(e){var n;switch(e.activeFeed.type){case h.FEED:n="/items/feeds/"+e.activeFeed.id;break;case h.FOLDER:n="/items/folders/"+e.activeFeed.id;break;case h.STARRED:n="/items/starred";break;case h.EXPLORE:n="/explore";break;default:n="/items"}/^\/items(\/(starred|explore|feeds\/\d+|folders\/\d+))?\/?$/.test(m)||t.path(n),v.resolve()});var y,E=r.defer();n.get(f+"/feeds").success(function(e){y=e,E.resolve()});var C,F=r.defer();n.get(f+"/folders").success(function(e){C=e,F.resolve()}),r.all([E.promise,F.promise]).then(function(){l.publishAll(y),l.publishAll(C),0===y.feeds.length&&0===C.folders.length&&t.path("/explore")}),r.all([g.promise,v.promise,E.promise,F.promise]).then(function(){o.reload(),s.setLoading("global",!1)}),i(function(){n.get(f+"/feeds").success(function(e){l.publishAll(e)}),n.get(f+"/folders").success(function(e){l.publishAll(e)})},1e3*p),e.$on("$routeChangeStart",function(){s.setLoading("content",!0)}),e.$on("$routeChangeSuccess",function(){s.setLoading("content",!1)}),e.$on("$routeChangeError",function(){t.path("/items")})}]),app.controller("AppController",["Loading","FeedResource","FolderResource",function(e,t,n){"use strict";this.loading=e,this.isFirstRun=function(){return 0===t.size()&&0===n.size()},this.play=function(e){this.playingItem=e}}]),app.controller("ContentController",["Publisher","FeedResource","ItemResource","SettingsResource","data","$route","$routeParams","$location","FEED_TYPE","ITEM_AUTO_PAGE_SIZE","Loading",function(e,t,n,r,i,o,s,a,u,d,c){"use strict";n.clear(),e.publishAll(i),this.isAutoPagingEnabled=!0,n.size()>=d?this.isNothingMoreToAutoPage=!1:this.isNothingMoreToAutoPage=!0,this.getItems=function(){return n.getAll()},this.toggleStar=function(e){n.toggleStar(e)},this.toggleItem=function(e){this.isCompactView()&&(e.show=!e.show)},this.isShowAll=function(){return r.get("showAll")},this.markRead=function(e){var r=n.get(e);r.keepUnread||r.unread!==!0||(n.markItemRead(e),t.markItemOfFeedRead(r.feedId))},this.getFeed=function(e){return t.getById(e)},this.toggleKeepUnread=function(e){var r=n.get(e);r.unread||(t.markItemOfFeedUnread(r.feedId),n.markItemRead(e,!1)),r.keepUnread=!r.keepUnread};var l=this,f=function(){var e=r.get("oldestFirst");if(l.isFeed()){var n=t.getById(s.id);n&&1===n.ordering?e=!0:n&&2===n.ordering&&(e=!1)}return e};this.orderBy=function(){return f()?"id":"-id"},this.isCompactView=function(){return r.get("compact")},this.isCompactExpand=function(){return r.get("compactExpand")},this.autoPagingEnabled=function(){return this.isAutoPagingEnabled},this.markReadEnabled=function(){return!r.get("preventReadOnScroll")},this.scrollRead=function(e){var r=[],i=[];e.forEach(function(e){var t=n.get(e);t.keepUnread||(r.push(e),i.push(t.feedId))}),r.length>0&&(t.markItemsOfFeedsRead(i),n.markItemsRead(r))},this.isFeed=function(){return o.current.$$route.type===u.FEED},this.autoPage=function(){if(!this.isNothingMoreToAutoPage){if(!this.isAutoPagingEnabled)return void(this.autoPageAgain=!0);this.isAutoPagingEnabled=!1,this.autoPageAgain=!1;var t=o.current.$$route.type,i=s.id,u=f(),l=r.get("showAll"),h=this,p=a.search().search;c.setLoading("autopaging",!0),n.autoPage(t,i,u,l,p).success(function(t){e.publishAll(t),t.items.length>=d?h.isAutoPagingEnabled=!0:h.isNothingMoreToAutoPage=!0,h.isAutoPagingEnabled&&h.autoPageAgain&&h.autoPage()}).error(function(){h.isAutoPagingEnabled=!0})["finally"](function(){c.setLoading("autopaging",!1)})}},this.getRelativeDate=function(e){if(void 0!==e&&""!==e){var t=r.get("language"),n=moment.unix(e).locale(t).fromNow()+"";return n}return""},this.refresh=function(){o.reload()},this.getMediaType=function(e){return e&&0===e.indexOf("audio")?"audio":e&&0===e.indexOf("video")?"video":void 0}}]),app.controller("ExploreController",["sites","$rootScope","FeedResource","SettingsResource","$location",function(e,t,n,r,i){"use strict";this.sites=e,this.feeds=Object.keys(e).map(function(t){return[t,e[t]]}).reduce(function(e,t){var n=t[0],r=t[1];return r.forEach(function(e){e.category=n}),e.concat(r)},[]),this.feedExists=function(e){return void 0!==n.getByLocation(e)},this.subscribeTo=function(e){t.$broadcast("addFeed",e)},this.isCategoryShown=function(e){return e.filter(function(e){return void 0===n.getByLocation(e.feed)}).length>0},this.getSupportedLanguageCodes=function(){return r.getSupportedLanguageCodes()},this.getCurrentLanguageCode=function(){var e=i.search().lang;return e||(e=r.get("language")),e},this.showLanguage=function(e){i.url("/explore/?lang="+e)},this.selectedLanguageCode=this.getCurrentLanguageCode()}]),app.controller("NavigationController",["$route","FEED_TYPE","FeedResource","FolderResource","ItemResource","SettingsResource","Publisher","$rootScope","$location","$q",function(e,t,n,r,i,o,s,a,u,d){"use strict";this.feedError="",this.showNewFolder=!1,this.renamingFolder=!1,this.addingFeed=!1,this.addingFolder=!1,this.folderError="",this.renameError="",this.feed={};var c=function(){return parseInt(e.current.params.id,10)};this.getLanguageCode=function(){return o.get("language")},this.getFeeds=function(){return n.getAll()},this.getFolders=function(){return r.getAll()},this.markFolderRead=function(e){n.markFolderRead(e),n.getByFolderId(e).forEach(function(e){i.markFeedRead(e.id)})},this.markFeedRead=function(e){i.markFeedRead(e),n.markFeedRead(e)},this.markRead=function(){i.markRead(),n.markRead()},this.isShowAll=function(){return o.get("showAll")},this.getFeedsOfFolder=function(e){return n.getByFolderId(e)},this.getUnreadCount=function(){return n.getUnreadCount()},this.isUnread=function(){return this.getUnreadCount()>0},this.getFeedUnreadCount=function(e){var t=n.getById(e);return void 0!==t?t.unreadCount:0},this.isFeedUnread=function(e){return this.getFeedUnreadCount(e)>0},this.getFolderUnreadCount=function(e){return n.getFolderUnreadCount(e)},this.isFolderUnread=function(e){return this.getFolderUnreadCount(e)>0},this.getStarredCount=function(){return i.getStarredCount()},this.isStarredUnread=function(){return this.getStarredCount()>0},this.toggleFolder=function(e){r.toggleOpen(e)},this.hasFeeds=function(e){return void 0!==n.getFolderUnreadCount(e)},this.subFeedActive=function(r){var i=e.current.$$route.type;if(i===t.FEED){var o=n.getById(c());if(void 0!==o&&o.folderId===r)return!0}return!1},this.isSubscriptionsActive=function(){return e.current&&e.current.$$route.type===t.SUBSCRIPTIONS},this.isStarredActive=function(){return e.current&&e.current.$$route.type===t.STARRED},this.isExploreActive=function(){return e.current&&e.current.$$route.type===t.EXPLORE},this.isFolderActive=function(n){return e.current&&e.current.$$route.type===t.FOLDER&&c()===n},this.isFeedActive=function(n){return e.current&&e.current.$$route.type===t.FEED&&c()===n},this.folderNameExists=function(e){return e=e||"",void 0!==r.get(e.trim())},this.feedUrlExists=function(e){return e=e||"",e=e.trim(),void 0!==n.get(e)||void 0!==n.get("http://"+e)},this.createFeed=function(e){var t=this;this.showNewFolder=!1,this.addingFeed=!0;var i=e.newFolder,o=e.existingFolder||{id:0};void 0===i||""===i?(o.getsFeed=!0,n.create(e.url,o.id,void 0).then(function(e){s.publishAll(e),u.path("/items/feeds/"+e.feeds[0].id+"/")})["finally"](function(){o.getsFeed=void 0,e.url="",t.addingFeed=!1})):r.create(i).then(function(n){s.publishAll(n),e.existingFolder=r.get(n.folders[0].name),e.newFolder=void 0,t.createFeed(e)})},this.createFolder=function(e){var t=this;this.addingFolder=!0,r.create(e.name).then(function(e){s.publishAll(e)})["finally"](function(){t.addingFolder=!1,e.name=""})},this.moveFeed=function(t,r){var i=!1,o=n.getById(t);o.folderId!==r&&((this.isFolderActive(o.folderId)||this.isFolderActive(r))&&(i=!0),n.move(t,r),i&&e.reload())},this.renameFeed=function(e){n.patch(e.id,{title:e.title}),e.editing=!1},this.renameFolder=function(e,t){e.renameError="",this.renamingFolder=!0;var n=this;e.name===t?(e.renameError="",e.editing=!1,this.renamingFolder=!1):r.rename(e.name,t).then(function(){e.renameError="",e.editing=!1},function(t){e.renameError=t})["finally"](function(){n.renamingFolder=!1})},this.reversiblyDeleteFeed=function(t){n.reversiblyDelete(t.id)["finally"](function(){e.reload()})},this.undoDeleteFeed=function(t){n.undoDelete(t.id)["finally"](function(){e.reload()})},this.deleteFeed=function(e){n["delete"](e.url)},this.reversiblyDeleteFolder=function(t){d.all(n.reversiblyDeleteFolder(t.id),r.reversiblyDelete(t.name))["finally"](function(){e.reload()})},this.undoDeleteFolder=function(t){d.all(n.undoDeleteFolder(t.id),r.undoDelete(t.name))["finally"](function(){e.reload()})},this.deleteFolder=function(e){n.deleteFolder(e.id),r["delete"](e.name)},this.setOrdering=function(t,r){n.patch(t.id,{ordering:r}),e.reload()},this.togglePinned=function(e){var t=n.getById(e);return t?n.patch(e,{pinned:!t.pinned}):void 0},this.setUpdateMode=function(e,t){return n.patch(e,{updateMode:t})},this.toggleFullText=function(t){a.$broadcast("$routeChangeStart"),n.toggleFullText(t.id)["finally"](function(){a.$broadcast("$routeChangeSuccess"),e.reload()})},this.search=function(e){""===e?u.search("search",null):u.search("search",e)};var l=this;a.$on("moveFeedToFolder",function(e,t){l.moveFeed(t.feedId,t.folderId)});var f=function(){var i;e.current&&(i=e.current.$$route.type);var o=0;if(i===t.FOLDER)o=c();else if(i===t.FEED){var s=n.getById(c());s&&(o=s.folderId)}var a;0!==o&&(a=r.getById(o)),l.feed.existingFolder=a};a.$on("$routeChangeSuccess",function(){f()})}]),app.controller("SettingsController",["$route","$q","SettingsResource","ItemResource","OPMLParser","OPMLImporter","Publisher",function(e,t,n,r,i,o,s){"use strict";this.isOPMLImporting=!1,this.isArticlesImporting=!1,this.opmlImportError=!1,this.articleImportError=!1;var a=function(t,r){n.set(t,r),["showAll","oldestFirst","compact"].indexOf(t)>=0&&e.reload()};this.toggleSetting=function(e){a(e,!this.getSetting(e))},this.getSetting=function(e){return n.get(e)},this.importOPML=function(e){this.opmlImportError=!1,this.articleImportError=!1;try{this.isOPMLImporting=!1;var t=i.parse(e),n=this,r=5;o.importFolders(t).then(function(e){return o.importFeedQueue(e,r)})["finally"](function(){n.isOPMLImporting=!1})}catch(s){console.error(s),this.isOPMLImporting=!1,this.opmlImportError=!0}},this.importArticles=function(e){this.opmlImportError=!1,this.articleImportError=!1;try{this.isArticlesImporting=!0;var t=JSON.parse(e),n=this;r.importArticles(t).success(function(e){s.publishAll(e)})["finally"](function(){n.isArticlesImporting=!1})}catch(i){console.error(i),this.articleImportError=!0,this.isArticlesImporting=!1}}}]),app.filter("trustUrl",["$sce",function(e){"use strict";return function(t){return e.trustAsResourceUrl(t)}}]),app.filter("unreadCountFormatter",function(){"use strict";return function(e){return e>999?"999+":e}}),app.factory("FeedResource",["Resource","$http","BASE_URL","$q",function(e,t,n,r){"use strict";var i=function(t,n,r){e.call(this,t,n,"url"),this.ids={},this.locations={},this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.$q=r};return i.prototype=Object.create(e.prototype),i.prototype.receive=function(t){e.prototype.receive.call(this,t),this.updateUnreadCache(),this.updateFolderCache()},i.prototype.clear=function(){e.prototype.clear.call(this),this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.ids={},this.locations={}},i.prototype.updateUnreadCache=function(){this.unreadCount=0,this.folderUnreadCount={};var e=this;this.values.forEach(function(t){t.unreadCount&&(e.unreadCount+=t.unreadCount),void 0!==t.folderId&&(e.folderUnreadCount[t.folderId]=e.folderUnreadCount[t.folderId]||0,e.folderUnreadCount[t.folderId]+=t.unreadCount)})},i.prototype.updateFolderCache=function(){this.folderIds={};var e=this;this.values.forEach(function(t){e.folderIds[t.folderId]=e.folderIds[t.folderId]||[],e.folderIds[t.folderId].push(t)})},i.prototype.add=function(t){e.prototype.add.call(this,t),void 0!==t.id&&(this.ids[t.id]=this.hashMap[t.url]),void 0!==t.location&&(this.locations[t.location]=this.hashMap[t.url])},i.prototype.markRead=function(){this.values.forEach(function(e){e.unreadCount=0}),this.updateUnreadCache()},i.prototype.markFeedRead=function(e){this.ids[e].unreadCount=0,this.updateUnreadCache()},i.prototype.markFolderRead=function(e){this.values.forEach(function(t){t.folderId===e&&(t.unreadCount=0)}),this.updateUnreadCache()},i.prototype.markItemOfFeedRead=function(e){this.ids[e].unreadCount-=1,this.updateUnreadCache()},i.prototype.markItemsOfFeedsRead=function(e){var t=this;e.forEach(function(e){t.ids[e].unreadCount-=1}),this.updateUnreadCache()},i.prototype.markItemOfFeedUnread=function(e){this.ids[e].unreadCount+=1,this.updateUnreadCache()},i.prototype.getUnreadCount=function(){return this.unreadCount},i.prototype.getFolderUnreadCount=function(e){return this.folderUnreadCount[e]},i.prototype.getByFolderId=function(e){return this.folderIds[e]||[]},i.prototype.getById=function(e){return this.ids[e]},i.prototype.getByLocation=function(e){return this.locations[e]},i.prototype.move=function(e,t){var n=this.getById(e);return n.folderId=t,this.updateFolderCache(),this.updateUnreadCache(),this.patch(e,{folderId:t})},i.prototype.create=function(e,t,n){e=e.trim(),e.startsWith("http")||(e="https://"+e),void 0!==n&&(n=n.trim());var r={url:e,folderId:t||0,title:n||e,unreadCount:0};this.add(r),this.updateFolderCache();var i=this.$q.defer();return this.http({method:"POST",url:this.BASE_URL+"/feeds",data:{url:e,parentFolderId:t||0,title:n}}).success(function(e){i.resolve(e)}).error(function(e){r.faviconLink="",r.error=e.message,i.reject()}),i.promise},i.prototype.reversiblyDelete=function(e,t,n){var r=this.getById(e);return r&&n!==!0&&(r.deleted=!0),t!==!1&&this.updateUnreadCache(),this.http["delete"](this.BASE_URL+"/feeds/"+e)},i.prototype.reversiblyDeleteFolder=function(e){var t=this,n=[];this.getByFolderId(e).forEach(function(e){n.push(t.reversiblyDelete(e.id,!1,!0))}),this.updateUnreadCache();var r=this.$q.all(n);return r.promise},i.prototype["delete"]=function(t,n){var r=this.get(t);return void 0!==r&&r.id&&delete this.ids[r.id],void 0!==r&&r.location&&delete this.locations[r.location],e.prototype["delete"].call(this,t),n!==!1&&(this.updateUnreadCache(),this.updateFolderCache()),r},i.prototype.deleteFolder=function(e){var t=this;this.getByFolderId(e).forEach(function(e){t["delete"](e.url,!1)}),this.updateUnreadCache(),this.updateFolderCache()},i.prototype.undoDelete=function(e,t){var n=this.getById(e);return n&&(n.deleted=!1),t!==!1&&this.updateUnreadCache(),this.http.post(this.BASE_URL+"/feeds/"+e+"/restore")},i.prototype.undoDeleteFolder=function(e){var t=this,n=[];this.getByFolderId(e).forEach(function(e){n.push(t.undoDelete(e.id,!1))}),this.updateUnreadCache();var r=this.$q.all(n);return r.promise},i.prototype.setOrdering=function(e,t){var n=this.getById(e);if(n){n.ordering=t;var r=this.BASE_URL+"/feeds/"+e;return this.http.patch(r,{ordering:t})}},i.prototype.setPinned=function(e,t){var n=this.getById(e);if(n){n.pinned=t;var r=this.BASE_URL+"/feeds/"+e;return this.http.patch(r,{pinned:t})}},i.prototype.patch=function(e,t){var n=this.getById(e);if(n){Object.keys(t).forEach(function(e){n[e]=t[e]});var r=this.BASE_URL+"/feeds/"+e;return this.http.patch(r,t)}},i.prototype.toggleFullText=function(e){var t=this.getById(e);return this.patch(e,{fullTextEnabled:!t.fullTextEnabled})},new i(t,n,r)}]),app.factory("FolderResource",["Resource","$http","BASE_URL","$q",function(e,t,n,r){"use strict";var i=function(t,n,r){e.call(this,t,n,"name"),this.deleted=null,this.$q=r,this.ids={}};return i.prototype=Object.create(e.prototype),i.prototype.add=function(t){e.prototype.add.call(this,t),void 0!==t.id&&(this.ids[t.id]=this.hashMap[t.name])},i.prototype.clear=function(){e.prototype.clear.call(this),this.ids={}},i.prototype["delete"]=function(t){var n=this.get(t);return void 0!==n&&n.id&&delete this.ids[n.id],e.prototype["delete"].call(this,t),n},i.prototype.toggleOpen=function(e){var t=this.get(e);return t.opened=!t.opened,this.http({url:this.BASE_URL+"/folders/"+t.id+"/open",method:"POST",data:{folderId:t.id,open:t.opened}})},i.prototype.rename=function(e,t){var n=this.get(e),r=this.$q.defer(),i=this;return this.http({url:this.BASE_URL+"/folders/"+n.id+"/rename",method:"POST",data:{folderName:t}}).success(function(){n.name=t,delete i.hashMap[e],i.hashMap[t]=n,r.resolve()}).error(function(e){r.reject(e.message)}),r.promise},i.prototype.getById=function(e){return this.ids[e]},i.prototype.create=function(e){e=e.trim();var t={name:e};this.add(t);var n=this.$q.defer();return this.http({url:this.BASE_URL+"/folders",method:"POST",data:{folderName:e}}).success(function(e){n.resolve(e)}).error(function(e){t.error=e.message}),n.promise},i.prototype.reversiblyDelete=function(e){var t=this.get(e),n=t.id;return t.deleted=!0,this.http["delete"](this.BASE_URL+"/folders/"+n)},i.prototype.undoDelete=function(e){var t=this.get(e),n=t.id;return t.deleted=!1,this.http.post(this.BASE_URL+"/folders/"+n+"/restore")},new i(t,n,r)}]),app.factory("ItemResource",["Resource","$http","BASE_URL","ITEM_BATCH_SIZE",function(e,t,n,r){"use strict";var i=function(t,n,r){e.call(this,t,n),this.batchSize=r,this.clear()};return i.prototype=Object.create(e.prototype),i.prototype.clear=function(){this.starredCount=0,this.lowestId=0,this.highestId=0,e.prototype.clear.call(this)},i.prototype.receive=function(t,n){switch(n){case"newestItemId":this.newestItemId=t;break;case"starred":this.starredCount=t;break;default:var r=this;t.forEach(function(e){0===r.lowestId&&(r.lowestId=e.id),0===r.highestId&&(r.highestId=e.id),e.id>r.highestId&&(r.highestId=e.id),e.id<r.lowestId&&(r.lowestId=e.id)}),e.prototype.receive.call(this,t,n)}},i.prototype.getNewestItemId=function(){return this.newestItemId},i.prototype.getStarredCount=function(){return this.starredCount},i.prototype.star=function(e,t){void 0===t&&(t=!0);var n=this.get(e),r=this.BASE_URL+"/items/"+n.feedId+"/"+n.guidHash+"/star";return n.starred=t,t?this.starredCount+=1:this.starredCount-=1,this.http({url:r,method:"POST",data:{isStarred:t}})},i.prototype.toggleStar=function(e){this.get(e).starred?this.star(e,!1):this.star(e,!0)},i.prototype.markItemRead=function(e,t){return void 0===t&&(t=!0),this.get(e).unread=!t,this.http({url:this.BASE_URL+"/items/"+e+"/read",method:"POST",data:{isRead:t}})},i.prototype.markItemsRead=function(e){var t=this;return e.forEach(function(e){t.get(e).unread=!1}),this.http({url:this.BASE_URL+"/items/read/multiple",method:"POST",data:{itemIds:e}})},i.prototype.markFeedRead=function(e,t){void 0===t&&(t=!0);var n=this.values.filter(function(t){return t.feedId===e});return n.forEach(function(e){e.unread=!t}),this.http.post(this.BASE_URL+"/feeds/"+e+"/read",{highestItemId:this.getNewestItemId()})},i.prototype.markRead=function(){return this.values.forEach(function(e){e.unread=!1}),this.http({url:this.BASE_URL+"/items/read",method:"POST",data:{highestItemId:this.getNewestItemId()}})},i.prototype.autoPage=function(e,t,n,r,i){var o;return o=n?this.highestId:this.lowestId,this.http({url:this.BASE_URL+"/items",method:"GET",params:{type:e,id:t,offset:o,limit:this.batchSize,oldestFirst:n,showAll:r,search:i}})},i.prototype.importArticles=function(e){return this.http({url:this.BASE_URL+"/feeds/import/articles",method:"POST",data:{json:e}})},new i(t,n,r)}]),app.service("Loading",function(){"use strict";this.loading={global:!1,content:!1,autopaging:!1},this.setLoading=function(e,t){this.loading[e]=t},this.isLoading=function(e){return this.loading[e]}}),app.service("OPMLImporter",["FeedResource","FolderResource","Publisher","$q",function(e,t,n,r){"use strict";var i=function(o){var s=r.defer();if(o.length>0){var a=o.pop(),u=a.url,d=a.title,c=0,l=a.folderName;if(void 0!==l&&void 0!==t.get(l)){var f=t.get(l);f.opened=!0,c=f.id,f.getsFeed=!0,f.getsFeedCounter=f.getsFeedCounter||0,f.getsFeedCounter+=1}void 0!==u&&void 0===e.get(u)&&e.create(u,c,d).then(function(e){n.publishAll(e)})["finally"](function(){0!==c&&(f.getsFeedCounter-=1,0===f.getsFeedCounter&&(f.getsFeed=!1)),i(o)})}else s.resolve();return s.promise};this.importFolders=function(e){var i=[],o=[];e.folders.forEach(function(e){if(void 0!==e.name){if(void 0===t.get(e.name)){var r=t.create(e.name).then(function(e){n.publishAll(e)});o.push(r)}e.feeds.forEach(function(t){t.folderName=e.name,i.push(t)})}}),i=i.concat(e.feeds);var s=r.defer();return r.all(o)["finally"](function(){s.resolve(i)}),s.promise},this.importFeedQueue=function(e,t){for(var n=r.defer(),o=[],s=0;t>s;s+=1)o.push(i(e));return r.all(o).then(function(){n.resolve()}),n.promise}}]),app.service("OPMLParser",function(){"use strict";var e=function(e){var t=e.attr("xmlUrl")||e.attr("htmlUrl"),n=e.attr("title")||e.attr("text")||t;return void 0===t?{type:"folder",name:n,feeds:[]}:{type:"feed",name:n,url:t}},t=function(n,r,i){for(var o=0;o<n.length;o+=1){var s=$(n[o]),a=e(s);"feed"===a.type?r.feeds.push(a):i?(t(s.children("outline"),a,!1),r.folders.push(a)):t(s.children("outline"),r,!1)}return r};this.parse=function(e){e=$.parseXML(e);var n=$(e).find("body > outline"),r={feeds:[],folders:[]};return t(n,r,!0)}}),app.service("Publisher",function(){"use strict";this.channels={},this.subscribe=function(e){var t=this;return{toChannels:function(n){n.forEach(function(n){t.channels[n]=t.channels[n]||[],t.channels[n].push(e)})}}},this.publishAll=function(e){var t=this;Object.keys(e).forEach(function(n){var r=t.channels[n];void 0!==r&&r.forEach(function(t){t.receive(e[n],n)})})}}),app.factory("Resource",function(){"use strict";var e=function(e,t,n){this.id=n||"id",this.values=[],this.hashMap={},this.http=e,this.BASE_URL=t};return e.prototype.receive=function(e){var t=this;e.forEach(function(e){t.add(e)})},e.prototype.add=function(e){var t=this.hashMap[e[this.id]];void 0===t?(this.values.push(e),this.hashMap[e[this.id]]=e):Object.keys(e).forEach(function(n){t[n]=e[n]})},e.prototype.size=function(){return this.values.length},e.prototype.get=function(e){return this.hashMap[e]},e.prototype["delete"]=function(e){var t=this,n=this.values.findIndex(function(n){return n[t.id]===e});void 0!==n&&this.values.splice(n,1),void 0!==this.hashMap[e]&&delete this.hashMap[e]},e.prototype.clear=function(){for(this.hashMap={};this.values.length>0;)this.values.pop()},e.prototype.getAll=function(){return this.values},e}),app.service("SettingsResource",["$http","BASE_URL",function(e,t){"use strict";this.settings={language:"en",showAll:null,compact:!1,oldestFirst:null,preventReadOnScroll:!1,compactExpand:!1,exploreUrl:""},this.defaultLanguageCode="en",this.supportedLanguageCodes=["ar-ma","ar","bg","ca","cs","cv","da","de","el","en","en-ca","en-gb","eo","es","et","eu","fi","fr-ca","fr","gl","he","hi","hu","id","is","it","ja","ka","ko","lv","ms-my","nb","ne","nl","pl","pt-br","pt","ro","ru","sk","sl","sv","th","tr","tzm-la","tzm","uk","zh-cn","zh-tw"],this.getSupportedLanguageCodes=function(){return this.supportedLanguageCodes},this.receive=function(e){var t=this;Object.keys(e).forEach(function(n){var r=e[n];"language"===n&&(r=t.processLanguageCode(r)),t.settings[n]=r})},this.get=function(e){return this.settings[e]},this.set=function(n,r){return this.settings[n]=r,e({url:t+"/settings",method:"PUT",data:{language:this.settings.language,showAll:this.settings.showAll,compact:this.settings.compact,oldestFirst:this.settings.oldestFirst,compactExpand:this.settings.compactExpand,preventReadOnScroll:this.settings.preventReadOnScroll}})},this.processLanguageCode=function(e){return e=e.replace("_","-").toLowerCase(),this.supportedLanguageCodes.indexOf(e)<0&&(e=e.split("-")[0]),this.supportedLanguageCodes.indexOf(e)<0&&(e=this.defaultLanguageCode),e}}]),function(e,t,n,r,i,o){"use strict";var s=e.location,a=e.localStorage,u=function(e,t,r){var i=n.isContentHandlerRegistered,o=function(e,t){return i?"new"!==i(e,t):a.getItem("registeredHandler")===t};n.registerContentHandler&&!o(e,t)&&(n.registerContentHandler(e,t,r),i||a.setItem("registeredHandler",t))},d=s.protocol+"//"+s.host+s.pathname,c=d+"?subscribe_to=%s",l="application/vnd.mozilla.maybe.feed",f="ownCloud News @ "+d;u(l,c,f),i(t).ready(function(){var e=r("?subscribe_to");if(e&&"undefined"!==e){i("#new-feed").show();var t=i('input[ng-model="Navigation.feed.url"]');t.val(e),t.trigger("input"),setTimeout(function(){t.focus()},1e3)}})}(window,document,navigator,url,$),function(e,t){"use strict";e.addEventListener("beforeunload",function(){var e=t.querySelector("#app-content");e.scrollTo(0,0)})}(window,document),function(e,t,n){"use strict";var r=function(e){return!(e.is("input")||e.is("select")||e.is("textarea")||e.is("checkbox"))},i=function(e){return!(e.shiftKey||e.altKey||e.ctrlKey||e.metaKey)},o=function(e){var t=".active > .app-navigation-entry-menu .mark-read button",n=e.find(t);n.length>0&&n.trigger("click")},s=function(e,t){var n=e.offset().top-t.offset().top,r=n+e.height(),i=t.height();return n>=0&&i>r},a=function(e,t,n){0===e.length||!n&&s(e,t)||t.scrollTop(e.offset().top-t.offset().top+t.scrollTop())},u=function(e){var t=e.find(".active");a(t,e.children("ul"),!0)},d=function(e){e.find(".active > a:visible").trigger("click")},c=function(e,t){if(0===t.scrollTop()){var n=t.find(".pull-to-refresh");n.hasClass("show-pull-to-refresh")?n.hasClass("done")&&d(e):n.addClass("show-pull-to-refresh")}},l=function(e,t){e.children("a:visible").trigger("click"),a(e,t.children("ul"))},f=function(e){var t=e.find(".active"),r=e.find(".explore-feed,.subscriptions-feed:visible,.starred-feed:visible,.feed:visible");if(t.hasClass("folder"))for(;t.length>0;){var i=t.find(".feed:visible");if(i.length>0)return void l(n(i[0]),e);t=t.next(".folder")}else for(var o=0;o<r.length-1;o+=1){var s=r[o];if(s===t[0]){var a=r[o+1];l(n(a),e);break}}},h=function(e){return e.parent().parent(".folder")},p=function(e,t){var r,i=e.find(".folder:visible");r=t?i.length-1:0,i.length>0&&l(n(i[r]),e)},g=function(e){var t=e.find(".active");if(t.hasClass("folder"))l(t.prevAll(".folder:visible").first(),e);else if(t.hasClass("feed")){var n=h(t);n.length>0?l(n,e):p(e,!0)}else p(e,!0)},v=function(e){var t=e.find(".active");if(t.hasClass("folder"))l(t.nextAll(".folder:visible").first(),e);else if(t.hasClass("feed")){var n=h(t);n.length>0?l(n.nextAll(".folder:visible").first(),e):p(e)}else p(e)},m=function(e){var t=e.find(".active"),r=e.find(".explore-feed,.subscriptions-feed:visible,.starred-feed:visible,.feed:visible");if(t.hasClass("folder")){for(var i=t.prev(".folder");i.length>0;){var o=i.find(".feed:visible");if(o.length>0)return void l(n(o[o.length-1]),e);i=i.prev(".folder")}var s=t.siblings(".feed");if(s.length>0)return void l(n(s[s.length-1]),e);var a=n(".starred-feed:visible");return void(a.length>0&&l(a,e))}for(var u=r.length-1;u>0;u-=1){var d=r[u];if(d===t[0]){var c=r[u-1];l(n(c),e);break}}},y=function(e,t){var r=e.find(".item");r.each(function(e,r){return r=n(r),r.height()+r.position().top>30?(t(r),!1):void 0})},E=function(e){y(e,function(e){e.find(".toggle-keep-unread").trigger("click")})},C=function(e){y(e,function(e){e.find(".star").trigger("click")})},F=function(e){y(e,function(e){e.find(".utils").trigger("click")})},I=function(t){y(t,function(t){t.trigger("click"),e.open(t.find(".external:visible").attr("href"),"_blank")})},w=function(e,t,n){e.scrollTop(t.offset().top-e.offset().top+e.scrollTop()),n&&y(e,function(e){e.hasClass("open")||e.find(".utils").trigger("click")})},R=function(e,t){var r=e.find(".item"),i=!1;r.each(function(r,o){return o=n(o),0===o.position().top&&t&&!o.hasClass("open")||o.position().top>10?(w(e,o,t),i=!0,!1):void 0}),i||e.scrollTop(e.prop("scrollHeight"))},b=function(e,t,r){var i=t.find(".item"),o=!1;i.each(function(i,s){if(s=n(s),s.position().top+10>=0){var a=s.prev();return a.length>0?w(t,a,r):(c(e,t),t.scrollTop(0)),o=!0,!1}}),!o&&i.length>0&&w(t,i.last())};n(t).keyup(function(e){var t=e.keyCode,s=n("#app-content"),a=n("#app-navigation"),l=n("#articles.compact").length>0,h="true"===n("#articles").attr("news-compact-expand"),p=l&&h;r(n(":focus"))&&i(e)?[74,78,39].indexOf(t)>=0?(e.preventDefault(),R(s,p)):[75,80,37].indexOf(t)>=0?(e.preventDefault(), -b(a,s,p)):[85].indexOf(t)>=0?(e.preventDefault(),E(s)):[69].indexOf(t)>=0?(e.preventDefault(),F(s)):[73,83,76].indexOf(t)>=0?(e.preventDefault(),C(s)):[72].indexOf(t)>=0?(e.preventDefault(),C(s),R(s)):[79].indexOf(t)>=0?(e.preventDefault(),I(s)):[82].indexOf(t)>=0?(e.preventDefault(),d(a)):[70].indexOf(t)>=0?(e.preventDefault(),f(a)):[68].indexOf(t)>=0?(e.preventDefault(),m(a)):[67].indexOf(t)>=0?(e.preventDefault(),g(a)):[65].indexOf(t)>=0?(e.preventDefault(),u(a)):[86].indexOf(t)>=0?(e.preventDefault(),v(a)):[81].indexOf(t)>=0?(e.preventDefault(),n("#searchbox").focus()):[33].indexOf(t)>=0&&c(a,s):r(n(":focus"))&&e.shiftKey&&[65].indexOf(t)>=0&&(e.preventDefault(),o(a))})}(window,document,$),window.News=window.News||{},function(e,t,n,r,i){"use strict";var o=[];r.addArticleAction=function(e){o.push(e)},r.getArticleActionPlugins=function(){return o}}(window,document,jQuery,window.News),app.run(["$document","$rootScope",function(e,t){"use strict";e.click(function(e){t.$broadcast("documentClicked",e)})}]),app.directive("appNavigationEntryUtils",function(){"use strict";return{restrict:"C",link:function(e,t){var n=t.siblings(".app-navigation-entry-menu"),r=$(t).find(".app-navigation-entry-utils-menu-button button");r.click(function(){n.toggleClass("open")}),e.$on("documentClicked",function(e,t){t.target!==r[0]&&n.removeClass("open")})}}}),app.directive("newsAddFeed",["$rootScope","$timeout",function(e,t){"use strict";return{restrict:"A",link:function(n,r){e.$on("addFeed",function(e,i){t(function(){r.is(":animated")?(r.stop(!0,!0),r.show()):r.is(":visible")||r.slideDown(),r.find('[ng-model="Navigation.feed.url"]').focus()}),n.Navigation.feed.url=i})}}}]),app.directive("newsArticleActions",function(){"use strict";return{restrict:"A",scope:{newsArticleActions:"=",noPlugins:"="},link:function(e,t){for(var n=News.getArticleActionPlugins(),r=0;r<n.length;r+=1)n[r](t,e.newsArticleActions);e.noPlugins=0===n.length}}}),app.directive("newsAutoFocus",["$timeout",function(e){"use strict";return function(t,n,r){var i=n;r.newsAutoFocus&&(i=$(r.newsAutoFocus)),e(function(){i.focus()},0)}}]),app.directive("newsBindHtmlUnsafe",function(){"use strict";return function(e,t,n){e.$watch(n.newsBindHtmlUnsafe,function(){t.html(e.$eval(n.newsBindHtmlUnsafe))})}}),app.directive("newsDraggable",function(){"use strict";return function(e,t,n){var r=e.$eval(n.newsDraggable);angular.isDefined(r)?t.draggable(r):t.draggable(),n.$observe("newsDraggableDisable",function(e){"true"===e?t.draggable("disable"):t.draggable("enable")})}}),app.directive("newsDroppable",["$rootScope",function(e){"use strict";return function(t,n,r){var i={accept:".feed",hoverClass:"drag-and-drop",greedy:!0,drop:function(i,o){$(".drag-and-drop").removeClass("drag-and-drop");var s={folderId:parseInt(n.data("id"),10),feedId:parseInt($(o.draggable).data("id"),10)};e.$broadcast("moveFeedToFolder",s),t.$apply(r.droppable)}};n.droppable(i)}}]),app.directive("newsFinishedTransition",function(){"use strict";return function(e,t,n){t.on("transitionend",function(){t.addClass(n.newsFinishedTransition)})}}),app.directive("newsFocus",["$timeout","$interpolate",function(e,t){"use strict";return function(n,r,i){r.click(function(){var r=$(t(i.newsFocus)(n));e(function(){r.focus()},500)})}}]),app.directive("newsInstantNotification",function(){"use strict";return{restrict:"E",link:function(e,t){t.hide();var n=t.html();OC.Notification.showHtml(n)}}}),app.directive("newsPlayOne",["$rootScope",function(e){"use strict";return{restrict:"A",link:function(t,n){n.on("play",function(){e.$broadcast("playing",n)}),e.$on("playing",function(e,t){t[0]!==n[0]&&n[0].pause()})}}}]),app.directive("newsPullToRefresh",["$rootScope",function(e){"use strict";var t=!1;return{restrict:"A",scope:{newsPullToRefresh:"="},link:function(n,r){e.$on("$routeChangeStart",function(){t=!1,n.newsPullToRefresh=!1}),r.on("scroll",function(){0===r.scrollTop()&&t&&(n.newsPullToRefresh=!0),t=!0})}}}]),app.directive("newsReadFile",function(){"use strict";return function(e,t,n){t.change(function(){var r=t[0].files[0],i=new FileReader;i.onload=function(t){e.$fileContent=t.target.result,e.$apply(n.newsReadFile)},i.readAsText(r)})}}),app.directive("newsRefreshMasonry",["$timeout",function(e){"use strict";var t=function(t){e(function(){e(function(){t.parent().masonry({itemSelector:".grid-item",gutter:25,columnWidth:300})},100)})};return function(e,n){e.$last&&t(n)}}]),app.directive("newsScroll",["$timeout","ITEM_AUTO_PAGE_SIZE","MARK_READ_TIMEOUT","SCROLL_TIMEOUT",function(e,t,n,r){"use strict";var i,o=function(e,t,n){for(var r=0,i=t.find(".item"),o=i.length-1;o>=0;o-=1){var s=$(i[o]);if(r>=e)break;if(s.position().top<0){n.$apply(n.newsScrollAutoPage);break}r+=1}},s=function(e,t,n){if(e){var r=[],i=t.find(".item:not(.read)");i.each(function(e,t){var n=$(t);return n.position().top<=-10?void r.push(parseInt(n.data("id"),10)):!1}),n.itemIds=r,n.$apply(n.newsScrollMarkRead)}};return{restrict:"A",scope:{newsScroll:"@",newsScrollAutoPage:"&",newsScrollMarkRead:"&",newsScrollEnabledMarkRead:"="},link:function(a,u){var d=!0,c=u;a.newsScroll&&(c=$(a.newsScroll));var l=function(){d&&(d=!1,e(function(){d=!0},1e3*r),o(t,u,a),i&&e.cancel(i),i=e(function(){s(a.newsScrollEnabledMarkRead,u,a),i=void 0},1e3*n))};c.on("scroll",l),a.$on("$destroy",function(){c.off("scroll",l)})}}}]),app.directive("newsSearch",["$document","$location",function(e,t){"use strict";return{restrict:"E",scope:{onSearch:"="},link:function(e){var n=$("#searchbox");n.val(t.search().search);var r=function(){var t=n.val();e.$apply(function(){e.onSearch(t)})};n.on("search keyup",function(e){"search"!==e.type&&13!==e.keyCode||r()}),e.$watch(function(){return t.search()},function(e){e&&e.search?n.val(e.search):n.val("")})}}}]),app.directive("newsStickyMenu",function(){"use strict";return function(e,t,n){var r=40;$(n.newsStickyMenu).scroll(function(){var e=$(this).scrollTop();e>r?(t.addClass("fixed"),t.css("top",e)):t.removeClass("fixed")})}}),app.directive("newsStopPropagation",function(){"use strict";return{restrict:"A",link:function(e,t){t.bind("click",function(e){e.stopPropagation()})}}}),app.directive("newsTimeout",["$timeout","$rootScope",function(e,t){"use strict";return{restrict:"A",scope:{newsTimeout:"&"},link:function(n,r){var i=!1,o=7,s=e(n.newsTimeout,1e3*o);n.$on("$destroy",function(){i=!0,e.cancel(s)}),t.$on("$locationChangeStart",function(){e.cancel(s),i||(i=!0,r.remove(),n.newsTimeout())})}}}]),app.directive("newsTitleUnreadCount",["$window",function(e){"use strict";var t=e.document.title,n=t.split("-"),r=n[0]||"News",i=n[1]||"ownCloud";return{restrict:"E",scope:{unreadCount:"@"},link:function(t,n,o){o.$observe("unreadCount",function(t){"0"!==t?e.document.title=r+"("+t+") - "+i:e.document.title=r+" - "+i})}}}]),app.directive("newsToggleShow",function(){"use strict";return{restrict:"A",scope:{newsToggleShow:"@"},link:function(e,t){t.click(function(){var t=$(e.newsToggleShow);t.toggle()})}}}),app.directive("newsTriggerClick",function(){"use strict";return function(e,t,n){t.click(function(){$(n.newsTriggerClick).trigger("click")})}}); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIj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gICAgICAgICAgY29uZmlnLnVybC5pbmRleE9mKGRvbWFpbikgPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgLypqc2hpbnQgY2FtZWxjYXNlOiBmYWxzZSAqL1xuICAgICAgICAgICAgICAgICAgICBjb25maWcuaGVhZGVycy5yZXF1ZXN0dG9rZW4gPSBvY19yZXF1ZXN0dG9rZW47XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgcmV0dXJuIGNvbmZpZyB8fCAkcS53aGVuKGNvbmZpZyk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgfV0pO1xuICAgIHZhciBlcnJvck1lc3NhZ2VzID0ge1xuICAgICAgICAwOiB0KCduZXdzJywgJ1JlcXVlc3QgZmFpbGVkLCBuZXR3b3JrIGNvbm5lY3Rpb24gdW5hdmFpbGFibGUhJyksXG4gICAgICAgIDQwMTogdCgnbmV3cycsICdSZXF1ZXN0IHVuYXV0aG9yaXplZC4gQXJlIHlvdSBsb2dnZWQgaW4/JyksXG4gICAgICAgIDQwMzogdCgnbmV3cycsICdSZXF1ZXN0IGZvcmJpZGRlbi4gQXJlIHlvdSBhbiBhZG1pbj8nKSxcbiAgICAgICAgNDEyOiB0KCduZXdzJywgJ1Rva2VuIGV4cGlyZWQgb3IgYXBwIG5vdCBlbmFibGVkISBSZWxvYWQgdGhlIHBhZ2UhJyksXG4gICAgICAgIDUwMDogdCgnbmV3cycsICdJbnRlcm5hbCBzZXJ2ZXIgZXJyb3IhIFBsZWFzZSBjaGVjayB5b3VyICcgK1xuICAgICAgICAgICAgICAgICAgICAgICAnZGF0YS9vd25jbG91ZC5sb2cgZmlsZSBmb3IgYWRkaXRpb25hbCAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgJ2luZm9ybWF0aW9uIScpLFxuICAgICAgICA1MDM6IHQoJ25ld3MnLCAnUmVxdWVzdCBmYWlsZWQsIG93bkNsb3VkIGlzIGluIGN1cnJlbnRseSAnICtcbiAgICAgICAgICAgICAgICAgICAgICAgJ2luIG1haW50ZW5hbmNlIG1vZGUhJyksXG4gICAgfTtcbiAgICAkcHJvdmlkZS5mYWN0b3J5KCdDb25uZWN0aW9uRXJyb3JJbnRlcmNlcHRvcicsIFtcIiRxXCIsIFwiJHRpbWVvdXRcIiwgZnVuY3Rpb24gKCRxLCAkdGltZW91dCkge1xuICAgICAgICB2YXIgdGltZXI7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICByZXNwb25zZUVycm9yOiBmdW5jdGlvbiAocmVzcG9uc2UpIHtcbiAgICAgICAgICAgICAgICAvLyBzdGF0dXMgMCBpcyBhIG5ldHdvcmsgZXJyb3JcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2Uuc3RhdHVzIGluIGVycm9yTWVzc2FnZXMpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRpbWVyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAkdGltZW91dC5jYW5jZWwodGltZXIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIE9DLk5vdGlmaWNhdGlvbi5oaWRlKCk7XG4gICAgICAgICAgICAgICAgICAgIE9DLk5vdGlmaWNhdGlvbi5zaG93SHRtbChlcnJvck1lc3NhZ2VzW3Jlc3BvbnNlLnN0YXR1c10pO1xuICAgICAgICAgICAgICAgICAgICB0aW1lciA9ICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIE9DLk5vdGlmaWNhdGlvbi5oaWRlKCk7XG4gICAgICAgICAgICAgICAgICAgIH0sIDUwMDApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gJHEucmVqZWN0KHJlc3BvbnNlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICB9XSk7XG4gICAgJGh0dHBQcm92aWRlci5pbnRlcmNlcHRvcnMucHVzaCgnQ1NSRkludGVyY2VwdG9yJyk7XG4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ZWNlaXZlXG4gICAgICAgICAgICAgICAgLy8gdGhlIHNldHRpbmdzIHJlcXVlc3QgZnJvbSB0aGUgc2VydmVyIHNvIGRvbnQgcXVlcnkgdGhlIHNlcnZlclxuICAgICAgICAgICAgICAgIGlmIChzaG93QWxsID09PSBudWxsIHx8IG9sZGVzdEZpcnN0ID09PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUoe30pO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBwYXJhbWV0ZXJzID0ge1xuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogdHlwZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpbWl0OiBJVEVNX0JBVENIX1NJWkUsXG4gICAgICAgICAgICAgICAgICAgICAgICBzaG93QWxsOiBzaG93QWxsLFxuICAgICAgICAgICAgICAgICAgICAgICAgb2xkZXN0Rmlyc3Q6IG9sZGVzdEZpcnN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgc2VhcmNoOiBzZWFyY2hcbiAgICAgICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgICAgICAgICBpZiAoJHJvdXRlLmN1cnJlbnQgIT09IHVuZGVmaW5lZCAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgJHJvdXRlLmN1cnJlbnQucGFyYW1zICE9PSB1bmRlZmluZWQgJiZcbiAgICAgICAgICAgICAgICAgICAgICAgICRyb3V0ZS5jdXJyZW50LnBhcmFtcy5pZCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJzLmlkID0gJHJvdXRlLmN1cnJlbnQucGFyYW1zLmlkO1xuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gY2hlY2sgaWYgYSBjdXN0b20gb3JkZXJpbmcgaXMgc2V0XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSBGRUVEX1RZUEUuRkVFRCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGZlZWQgPSBGZWVkUmVzb3VyY2UuZ2V0QnlJZChwYXJhbWV0ZXJzLmlkKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gb24gaW50aWFsIGxvYWQsIHRoZSBmZWVkIG9yZGVyaW5nIGlzIHVuZGVmaW5lZFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZlZWQgPT09IHVuZGVmaW5lZCB8fCBmZWVkLm9yZGVyaW5nID09PSAyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVycy5vbGRlc3RGaXJzdCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChmZWVkLm9yZGVyaW5nID09PSAxKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVycy5vbGRlc3RGaXJzdCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAkaHR0cCh7XG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICBCQVNFX1VSTCArICcvaXRlbXMnLFxuICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnR0VUJyxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtczogcGFyYW1ldGVyc1xuICAgICAgICAgICAgICAgICAgICB9KS5zdWNjZXNzKGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZC5yZXNvbHZlKGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gZGVmZXJyZWQucHJvbWlzZTtcbiAgICAgICAgICAgIH1dXG4gICAgICAgIH07XG4gICAgfTtcblxuICAgIHZhciBnZXRFeHBsb3J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AgICAgICAgdmFyIGV4cGxvcmVVcmwgPSB1cmwgKyAnL2ZlZWRzLicgKyBsYW5ndWFnZSArICcuanNvbic7XG4gICAgICAgICAgICAgICAgICAgIHZhciBkZWZhdWx0RXhwbG9yZVVybCA9IHVybCArICcvZmVlZHMuZW4uanNvbic7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAkaHR0cFxuICAgICAgICAgICAgICAgICAgICAgICAgLmdldChleHBsb3JlVXJsKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmNhdGNoKGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJGh0dHAuZ2V0KGRlZmF1bHRFeHBsb3JlVXJsKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbiAoZGF0YSkge1xuICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZC5yZXNvbHZlKGRhdGEuZGF0YSk7XG4gICAgICAgICAgICAgICAgfSkuY2F0Y2goZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZC5yZWplY3QoKTtcbiAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZC5wcm9taXNlO1xuICAgICAgICAgICAgfV1cbiAgICAgICAgfTtcbiAgICB9O1xuXG4gICAgJHJvdXRlUHJvdmlkZXJcbiAgICAgICAgLndoZW4oJy9pdGVtcycsIHtcbiAgICAgICAgICAgIGNvbnRyb2xsZXI6ICdDb250ZW50Q29udHJvbGxlciBhcyBDb250ZW50JyxcbiAgICAgICAgICAgIHRlbXBsYXRlVXJsOiAnY29udGVudC5odG1sJyxcbiAgICAgICAgICAgIHJlc29sdmU6IGdldEl0ZW1SZXNvbHZlKGZlZWRUeXBlLlNVQlNDUklQVElPTlMpLFxuICAgICAgICAgICAgdHlwZTogZmVlZFR5cGUuU1VCU0NSSVBUSU9OU1xuICAgICAgICB9KVxuICAgICAgICAud2hlbignL2l0ZW1zL3N0YXJyZWQnLCB7XG4gICAgICAgICAgICBjb250cm9sbGVyOiAnQ29udGVudENvbnRyb2xsZXIgYXMgQ29udGVudCcsXG4gICAgICAgICAgICB0ZW1wbGF0ZVVybDogJ2NvbnRlbnQuaHRtbCcsXG4gICAgICAgICAgICByZXNvbHZlOiBnZXRJdGVtUmVzb2x2ZShmZWVkVHlwZS5TVEFSUkVEKSxcbiAgICAgICAgICAgIHR5cGU6IGZlZWRUeXBlLlNUQVJSRURcbiAgICAgICAgfSlcbiAgICAgICAgLndoZW4oJy9pdGVtcy9mZWVkcy86aWQnLCB7XG4gICAgICAgICAgICBjb250cm9sbGVyOiAnQ29udGVudENvbnRyb2xsZXIgYXMgQ29udGVudCcsXG4gICAgICAgICAgICB0ZW1wbGF0ZVVybDogJ2NvbnRlbnQuaHRtbCcsXG4gICAgICAgICAgICByZXNvbHZlOiBnZXRJdGVtUmVzb2x2ZShmZWVkVHlwZS5GRUVEKSxcbiAgICAgICAgICAgIHR5cGU6IGZlZWRUeXBlLkZFRURcbiAgICAgICAgfSlcbiAgICAgICAgLndoZW4oJy9pdGVtcy9mb2xkZXJzLzppZCcsIHtcbiAgICAgICAgICAgIGNvbnRyb2xsZXI6ICdDb250ZW50Q29udHJvbGxlciBhcyBDb250ZW50JyxcbiAgICAgICAgICAgIHRlbXBsYXRlVXJsOiAnY29udGVudC5odG1sJyxcbiAgICAgICAgICAgIHJlc29sdmU6IGdldEl0ZW1SZXNvbHZlKGZlZWRUeXBlLkZPTERFUiksXG4gICAgICAgICAgICB0eXBlOiBmZWVkVHlwZS5GT0xERVJcbiAgICAgICAgfSkud2hlbignL2V4cGxvcmUnLCB7XG4gICAgICAgICAgICBjb250cm9sbGVyOiAnRXhwbG9yZUNvbnRyb2xsZXIgYXMgRXhwbG9yZScsXG4gICAgICAgICAgICB0ZW1wbGF0ZVVybDogJ2V4cGxvcmUuaHRtbCcsXG4gICAgICAg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0F1dG9QYWdpbmdFbmFibGVkO1xuICAgIH07XG5cbiAgICB0aGlzLm1hcmtSZWFkRW5hYmxlZCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgcmV0dXJuICFTZXR0aW5nc1Jlc291cmNlLmdldCgncHJldmVudFJlYWRPblNjcm9sbCcpO1xuICAgIH07XG5cbiAgICB0aGlzLnNjcm9sbFJlYWQgPSBmdW5jdGlvbiAoaXRlbUlkcykge1xuICAgICAgICB2YXIgaWRzID0gW107XG4gICAgICAgIHZhciBmZWVkSWRzID0gW107XG5cbiAgICAgICAgaXRlbUlkcy5mb3JFYWNoKGZ1bmN0aW9uIChpdGVtSWQpIHtcbiAgICAgICAgICAgIHZhciBpdGVtID0gSXRlbVJlc291cmNlLmdldChpdGVtSWQpO1xuICAgICAgICAgICAgaWYgKCFpdGVtLmtlZXBVbnJlYWQpIHtcbiAgICAgICAgICAgICAgICBpZHMucHVzaChpdGVtSWQpO1xuICAgICAgICAgICAgICAgIGZlZWRJZHMucHVzaChpdGVtLmZlZWRJZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGlmIChpZHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgRmVlZFJlc291cmNlLm1hcmtJdGVtc09mRmVlZHNSZWFkKGZlZWRJZHMpO1xuICAgICAgICAgICAgSXRlbVJlc291cmNlLm1hcmtJdGVtc1JlYWQoaWRzKTtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICB0aGlzLmlzRmVlZCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgcmV0dXJuICRyb3V0ZS5jdXJyZW50LiQkcm91dGUudHlwZSA9PT0gRkVFRF9UWVBFLkZFRUQ7XG4gICAgfTtcblxuICAgIHRoaXMuYXV0b1BhZ2UgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIGlmICh0aGlzLmlzTm90aGluZ01vcmVUb0F1dG9QYWdlKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICA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tcbiAgICAgICAgICAgICAgICBzZWxmLnJlbmFtaW5nRm9sZGVyID0gZmFsc2U7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICB0aGlzLnJldmVyc2libHlEZWxldGVGZWVkID0gZnVuY3Rpb24gKGZlZWQpIHtcbiAgICAgICAgRmVlZFJlc291cmNlLnJldmVyc2libHlEZWxldGUoZmVlZC5pZCkuZmluYWxseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAkcm91dGUucmVsb2FkKCk7XG4gICAgICAgIH0pO1xuICAgIH07XG5cbiAgICB0aGlzLnVuZG9EZWxldGVGZWVkID0gZnVuY3Rpb24gKGZlZWQpIHtcbiAgICAgICAgRmVlZFJlc291cmNlLnVuZG9EZWxldGUoZmVlZC5pZCkuZmluYWxseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAkcm91dGUucmVsb2FkKCk7XG4gICAgICAgIH0pO1xuICAgIH07XG5cbiAgICB0aGlzLmRlbGV0ZUZlZWQgPSBmdW5jdGlvbiAoZmVlZCkge1xuICAgICAgICBGZWVkUmVzb3VyY2UuZGVsZXRlKGZlZWQudXJsKTtcbiAgICB9O1xuXG5cbiAgICB0aGlzLnJldmVyc2libHlEZWxldGVGb2xkZXIgPSBmdW5jdGlvbiAoZm9sZGVyKSB7XG4gICAgICAgICRxLmFsbChcbiAgICAgICAgICAgIEZlZWRSZXNvdXJjZS5yZXZlcnNpYmx5RGVsZXRlRm9sZGVyKGZvbGRlci5pZCksXG4gICAgICAgICAgICBGb2xkZXJSZXNvdXJjZS5yZXZlcnNpYmx5RGVsZXRlKGZvbGRlci5uYW1lKVxuICAgICAgICApLmZpbmFsbHkoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgJHJvdXRlLnJlbG9hZCgpO1xuICAgICAgICB9KTtcbiAgICB9O1xuXG4gICAgdGhpcy51bmRvRGVsZXRlRm9sZGVyID0gZnVuY3Rpb24gKGZvbGRlcikge1xuICAgICAgIC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R0aW5nKGtleSkpO1xuICAgIH07XG5cbiAgICB0aGlzLmdldFNldHRpbmcgPSBmdW5jdGlvbiAoa2V5KSB7XG4gICAgICAgIHJldHVybiBTZXR0aW5nc1Jlc291cmNlLmdldChrZXkpO1xuICAgIH07XG5cbiAgICB0aGlzLmltcG9ydE9QTUwgPSBmdW5jdGlvbiAoY29udGVudCkge1xuICAgICAgICB0aGlzLm9wbWxJbXBvcnRFcnJvciA9IGZhbHNlO1xuICAgICAgICB0aGlzLmFydGljbGVJbXBvcnRFcnJvciA9IGZhbHNlO1xuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICB0aGlzLmlzT1BNTEltcG9ydGluZyA9IGZhbHNlO1xuICAgICAgICAgICAgdmFyIHBhcnNlZENvbnRlbnQgPSBPUE1MUGFyc2VyLnBhcnNlKGNvbnRlbnQpO1xuXG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgICAgICB2YXIgam9iU2l6ZSA9IDU7XG5cbiAgICAgICAgICAgIE9QTUxJbXBvcnRlci5pbXBvcnRGb2xkZXJzKHBhcnNlZENvbnRlbnQpXG4gICAgICAgICAgICAudGhlbihmdW5jdGlvbiAoZmVlZFF1ZXVlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIE9QTUxJbXBvcnRlci5pbXBvcnRGZWVkUXVldWUoZmVlZFF1ZXVlLCBqb2JTaXplKTtcbiAgICAgICAgICAgIH0pLmZpbmFsbHkoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgIHNlbGYuaXNPUE1MSW1wb3J0aW5nID0gZmFsc2U7XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICAgICAgY29uc29sZS5lcnJvcihlcnJvcik7XG4gICAgICAgICAgICB0aGlzLmlzT1BNTEltcG9ydGluZyA9IGZhbHNlO1xuICAgICAgICAgICAgdGhpcy5vcG1sSW1wb3J0RXJyb3IgPSB0cnVlO1xuICA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G9jYXRpb25zW2xvY2F0aW9uXTtcbiAgICB9O1xuXG5cbiAgICBGZWVkUmVzb3VyY2UucHJvdG90eXBlLm1vdmUgPSBmdW5jdGlvbiAoZmVlZElkLCBmb2xkZXJJZCkge1xuICAgICAgICB2YXIgZmVlZCA9IHRoaXMuZ2V0QnlJZChmZWVkSWQpO1xuICAgICAgICBmZWVkLmZvbGRlcklkID0gZm9sZGVySWQ7XG5cbiAgICAgICAgdGhpcy51cGRhdGVGb2xkZXJDYWNoZSgpO1xuICAgICAgICB0aGlzLnVwZGF0ZVVucmVhZENhY2hlKCk7XG5cbiAgICAgICAgcmV0dXJuIHRoaXMucGF0Y2goZmVlZElkLCB7Zm9sZGVySWQ6IGZvbGRlcklkfSk7XG5cbiAgICB9O1xuXG5cbiAgICBGZWVkUmVzb3VyY2UucHJvdG90eXBlLmNyZWF0ZSA9IGZ1bmN0aW9uICh1cmwsIGZvbGRlcklkLCB0aXRsZSkge1xuICAgICAgICB1cmwgPSB1cmwudHJpbSgpO1xuICAgICAgICBpZiAoIXVybC5zdGFydHNXaXRoKCdodHRwJykpIHtcbiAgICAgICAgICAgIHVybCA9ICdodHRwczovLycgKyB1cmw7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGl0bGUgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS50cmltKCk7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgZmVlZCA9IHtcbiAgICAgICAgICAgIHVybDogdXJsLFxuICAgICAgICAgICAgZm9sZGVySWQ6IGZvbGRlcklkIHx8IDAsXG4gICAgICAgICAgICB0aXRsZTogdGl0bGUgfHwgdXJsLFxuICAgICAgICAgICAgdW5yZWFkQ291bnQ6IDBcbiAgICAgICAgfTtcblxuICAgICAgICB0aGlzLmFkZChmZWVkKTtcbiAgICAgICAgdGhpcy51cGRhdGVGb2xkZXJDYWNoZSgpO1xuXG4gICAgICAgIHZhciBkZWZlcnJlZCA9IHRoaXMuJHEu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zLmdldEJ5SWQoZmVlZElkKTtcblxuICAgICAgICBpZiAoZmVlZCkge1xuICAgICAgICAgICAgZmVlZC5vcmRlcmluZyA9IG9yZGVyaW5nO1xuICAgICAgICAgICAgdmFyIHVybCA9IHRoaXMuQkFTRV9VUkwgKyAnL2ZlZWRzLycgKyBmZWVkSWQ7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5odHRwLnBhdGNoKHVybCwge1xuICAgICAgICAgICAgICAgIG9yZGVyaW5nOiBvcmRlcmluZ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9O1xuXG5cbiAgICBGZWVkUmVzb3VyY2UucHJvdG90eXBlLnNldFBpbm5lZCA9IGZ1bmN0aW9uIChmZWVkSWQsIGlzUGlubmVkKSB7XG4gICAgICAgIHZhciBmZWVkID0gdGhpcy5nZXRCeUlkKGZlZWRJZCk7XG5cbiAgICAgICAgaWYgKGZlZWQpIHtcbiAgICAgICAgICAgIGZlZWQucGlubmVkID0gaXNQaW5uZWQ7XG4gICAgICAgICAgICB2YXIgdXJsID0gdGhpcy5CQVNFX1VSTCArICcvZmVlZHMvJyArIGZlZWRJZDtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmh0dHAucGF0Y2godXJsLCB7XG4gICAgICAgICAgICAgICAgcGlubmVkOiBpc1Bpbm5lZFxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICB9O1xuXG5cbiAgICBGZWVkUmVzb3VyY2UucHJvdG90eXBlLnBhdGNoID0gZnVuY3Rpb24gKGZlZWRJZCwgZGlmZikge1xuICAgICAgICB2YXIgZmVlZCA9IHRoaXMuZ2V0QnlJZChmZWVkSWQpO1xuXG4gICAgICAgIGlmIChmZWVkKSB7XG4gICAgICAgICAgICBPYmplY3Qua2V5cyhkaWZmKS5mb3JFYWNoKGZ1bmN0aW9uKGtleSkge1xuICAgICAgICAgICAgICAgIGZlZWRba2V5XSA9IGRpZmZba2V5XTtcbiAgICAgICAgICAgIH0pO1xuIC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VzdElkID0gMDtcbiAgICAgICAgUmVzb3VyY2UucHJvdG90eXBlLmNsZWFyLmNhbGwodGhpcyk7XG4gICAgfTtcblxuICAgIEl0ZW1SZXNvdXJjZS5wcm90b3R5cGUucmVjZWl2ZSA9IGZ1bmN0aW9uICh2YWx1ZSwgY2hhbm5lbCkge1xuICAgICAgICBzd2l0Y2ggKGNoYW5uZWwpIHtcblxuICAgICAgICBjYXNlICduZXdlc3RJdGVtSWQnOlxuICAgICAgICAgICAgdGhpcy5uZXdlc3RJdGVtSWQgPSB2YWx1ZTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGNhc2UgJ3N0YXJyZWQnOlxuICAgICAgICAgICAgdGhpcy5zdGFycmVkQ291bnQgPSB2YWx1ZTtcbiAgICAgICAgICAgIGJyZWFrO1xuXG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgICAgICB2YWx1ZS5mb3JFYWNoKGZ1bmN0aW9uIChpdGVtKSB7XG4gICAgICAgICAgICAgICAgLy8gaW5pdGlhbGl6ZSBsb3dlc3QgYW5kIGhpZ2hlc3QgaWRcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5sb3dlc3RJZCA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLmxvd2VzdElkID0gaXRlbS5pZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKHNlbGYuaGlnaGVzdElkID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuaGlnaGVzdElkID0gaXRlbS5pZDtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoaXRlbS5pZCA+IHNlbGYuaGlnaGVzdElkKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYuaGlnaGVzdElkID0gaXRlbS5pZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKGl0ZW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oaXMuc3RhcnJlZENvdW50IC09IDE7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gdGhpcy5odHRwKHtcbiAgICAgICAgICAgIHVybDogdXJsLFxuICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsXG4gICAgICAgICAgICBkYXRhOiB7XG4gICAgICAgICAgICAgICAgaXNTdGFycmVkOiBpc1N0YXJyZWRcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfTtcblxuXG4gICAgSXRlbVJlc291cmNlLnByb3RvdHlwZS50b2dnbGVTdGFyID0gZnVuY3Rpb24gKGl0ZW1JZCkge1xuICAgICAgICBpZiAodGhpcy5nZXQoaXRlbUlkKS5zdGFycmVkKSB7XG4gICAgICAgICAgICB0aGlzLnN0YXIoaXRlbUlkLCBmYWxzZSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnN0YXIoaXRlbUlkLCB0cnVlKTtcbiAgICAgICAgfVxuICAgIH07XG5cblxuICAgIEl0ZW1SZXNvdXJjZS5wcm90b3R5cGUubWFya0l0ZW1SZWFkID0gZnVuY3Rpb24gKGl0ZW1JZCwgaXNSZWFkKSB7XG4gICAgICAgIGlmIChpc1JlYWQgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgaXNSZWFkID0gdHJ1ZTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMuZ2V0KGl0ZW1JZCkudW5yZWFkID0gIWlzUmVhZDtcblxuICAgICAgICByZXR1cm4gdGhpcy5odHRwKHtcbiAgICAgICAgICAgIHVybDogdGhpcy5CQVNFX1VSTCArICcvaXRlbXMvJyArIGl0ZW1JZCArICcvcmVhZCcsXG4gICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcbiAgICAgICAgICAgIGRhdGE6IHtcbiAgICAgICAgICAgICAgICBpc1JlYWQ6IGlzUmVhZFxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9O1xuXG5cbiAgICBJdGV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yIHN0YXJ0RmVlZEpvYiA9IGZ1bmN0aW9uIChxdWV1ZSkge1xuICAgICAgICB2YXIgZGVmZXJyZWQgPSAkcS5kZWZlcigpO1xuXG4gICAgICAgIGlmIChxdWV1ZS5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICB2YXIgZmVlZCA9IHF1ZXVlLnBvcCgpO1xuICAgICAgICAgICAgdmFyIHVybCA9IGZlZWQudXJsO1xuICAgICAgICAgICAgdmFyIHRpdGxlID0gZmVlZC50aXRsZTtcbiAgICAgICAgICAgIHZhciBmb2xkZXJJZCA9IDA7XG4gICAgICAgICAgICB2YXIgZm9sZGVyTmFtZSA9IGZlZWQuZm9sZGVyTmFtZTtcblxuICAgICAgICAgICAgaWYgKGZvbGRlck5hbWUgIT09IHVuZGVmaW5lZCAmJlxuICAgICAgICAgICAgICAgIEZvbGRlclJlc291cmNlLmdldChmb2xkZXJOYW1lKSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgdmFyIGZvbGRlciA9IEZvbGRlclJlc291cmNlLmdldChmb2xkZXJOYW1lKTtcbiAgICAgICAgICAgICAgICBmb2xkZXIub3BlbmVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBmb2xkZXJJZCA9IGZvbGRlci5pZDtcblxuICAgICAgICAgICAgICAgIC8vIGRpc3BsYXkgZm9sZGVyIHdoaWxlIGFkZGluZyB0aGUgZmVlZFxuICAgICAgICAgICAgICAgIGZvbGRlci5nZXRzRmVlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgZm9sZGVyLmdldHNGZWVkQ291bnRlciA9IGZvbGRlci5nZXRzRmVlZENvdW50ZXIgfHwgMDtcbiAgICAgICAgICAgICAgICBmb2xkZXIuZ2V0c0ZlZWRDb3VudGVyICs9IDE7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIG1ha2Ugc3VyZSB0byBub3QgYWRkIGFscmVhZHkgZXhpc3RpbmcgZmVlZHNcbiAgICAgICAgICAgIGlmICh1cmwgIT09IHVuZGVmaW5lZCAmJiBGZWVkUmVzb3VyY2UuZ2V0KHVybCkgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgIEZlZWRSZXNvdXJjZS5jcmVhdGUodXJsLCBmb2xkZXJJZCwgdGl0bGUpXG4gICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24gKGRhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgUHVibGlzaGVyLnB1Ymxpc2hBbGwoZGF0YSk7XG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAuZmluYWxseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChmb2xkZXJJZCAhPT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZm9sZGVyLmdldHNGZWVkQ291bnRlciAtPSAxO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZm9sZGVyLmdldHNGZWVkQ291bnRlciA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvbGRlci5nZXRzRmVlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHN0YXJ0RmVlZEpvYihxdWV1ZSk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBkZWZlcnJlZC5yZXNvbHZlKCk7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZGVmZXJyZWQucHJvbWlzZTtcbiAgICB9O1xuXG4gICAgdGhpcy5pbXBvcnRGb2xkZXJzID0gZnVuY3Rpb24gKGNvbnRlbnQpIHtcbiAgICAgICAgLy8gYXNzdW1wdGlvbjogZm9sZGVycyBhcmUgZmFzdCB0byBjcmVhdGUgYW5kIHdlIGRvbnQgbmVlZCBhIHF1ZXVlIGZvclxuICAgICAgICAvLyB0aGVtXG4gICAgICAgIHZhciBmZWVkUXVldWUgPSBbXTtcbiAgICAgICAgdmFyIGZvbGRlclByb21pc2VzID0gW107XG4gICAgICAgIGNvbnRlbnQuZm9sZGVycy5mb3JFYWNoKGZ1bmN0aW9uIChmb2xkZXIpIHtcbiAgICAgICAgICAgIGlmIChmb2xkZXIubmFtZSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgLy8gc2tpcCBhbHJlYWR5IGNyZWF0ZWQgZm9sZGVyc1xuICAgICAgICAgICAgICAgIGlmIChGb2xkZXJSZXNvdXJjZS5nZXQoZm9sZGVyLm5hbWUpID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHByb21pc2UgPSBGb2xkZXJSZXNvdXJjZS5jcmVhdGUoZm9sZGVyLm5hbWUpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBQdWJsaXNoZXIucHVibGlzaEFsbChkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIGZvbGRlclByb21pc2VzLnB1c2gocHJvbWlzZSk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgZm9sZGVyLmZlZWRzLmZvckVhY2goZnVuY3Rpb24gKGZlZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgZmVlZC5mb2xkZXJOYW1lID0gZm9sZGVyLm5hbWU7XG4gICAgICAgICAgICAgICAgICAgIGZlZWRRdWV1ZS5wdXNoKGZlZWQpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgZmVlZFF1ZXVlID0gZmVlZFF1ZXVlLmNvbmNhdChjb250ZW50LmZlZWRzKTtcblxuICAgICAgICB2YXIgZGVmZXJyZWQgPSAkcS5kZWZlcigpO1xuXG4gICAgICAgICRxLmFsbChmb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gICAgICAgICAgdmFyIG91dGxpbmUgPSAkKGxldmVsW2ldKTtcblxuICAgICAgICAgICAgdmFyIGVudHJ5ID0gcGFyc2VPdXRsaW5lKG91dGxpbmUpO1xuXG4gICAgICAgICAgICBpZiAoZW50cnkudHlwZSA9PT0gJ2ZlZWQnKSB7XG4gICAgICAgICAgICAgICAgcm9vdC5mZWVkcy5wdXNoKGVudHJ5KTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgICAgICAvLyBvbmx5IGZpcnN0IGxldmVsIHNob3VsZCBhcHBlbmQgZm9sZGVyc1xuICAgICAgICAgICAgICAgIGlmIChmaXJzdExldmVsKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlY3Vyc2l2ZWx5UGFyc2Uob3V0bGluZS5jaGlsZHJlbignb3V0bGluZScpLCBlbnRyeSwgZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICByb290LmZvbGRlcnMucHVzaChlbnRyeSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVjdXJzaXZlbHlQYXJzZShvdXRsaW5lLmNoaWxkcmVuKCdvdXRsaW5lJyksIHJvb3QsIGZhbHNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gcm9vdDtcbiAgICB9O1xuXG4gICAgdGhpcy5wYXJzZSA9IGZ1bmN0aW9uICh4bWwpIHtcbiAgICAgICAgeG1sID0gJC5wYXJzZVhNTCh4bWwpO1xuICAgICAgICB2YXIgZmlyc3RMZXZlbCA9ICQoeG1sKS5maW5kKCdib2R5ID4gb3V0bGluZScpO1xuXG4gICAgICAgIHZhciByb290ID0ge1xuICAgICAgICAgICAgJ2ZlZWRzJzogW10sXG4gICAgICAgICAgICAnZm9sZGVycyc6IFtdXG4gICAgICAgIH07XG5cbiAgICAgICAgcmV0dXJuIHJlY3Vyc2l2ZWx5UGFyc2UoZmlyc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djYScsICdjcycsICdjdicsICdkYScsICdkZScsICdlbCcsICdlbicsICdlbi1jYScsXG4gICAgICAgICdlbi1nYicsICdlbycsICdlcycsICdldCcsICdldScsICdmaScsICdmci1jYScsICdmcicsICdnbCcsICdoZScsICdoaScsXG4gICAgICAgICdodScsICdpZCcsICdpcycsICdpdCcsICdqYScsICdrYScsICdrbycsICdsdicsICdtcy1teScsICduYicsICduZScsXG4gICAgICAgICdubCcsICdwbCcsICdwdC1icicsICdwdCcsICdybycsICdydScsICdzaycsICdzbCcsICdzdicsICd0aCcsICd0cicsXG4gICAgICAgICd0em0tbGEnLCAndHptJywgJ3VrJywgJ3poLWNuJywgJ3poLXR3J1xuICAgIF07XG5cbiAgICB0aGlzLmdldFN1cHBvcnRlZExhbmd1YWdlQ29kZXMgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLnN1cHBvcnRlZExhbmd1YWdlQ29kZXM7XG4gICAgfTtcblxuICAgIHRoaXMucmVjZWl2ZSA9IGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgT2JqZWN0LmtleXMoZGF0YSkuZm9yRWFjaChmdW5jdGlvbiAoa2V5KSB7XG4gICAgICAgICAgICB2YXIgdmFsdWUgPSBkYXRhW2tleV07XG5cbiAgICAgICAgICAgIGlmIChrZXkgPT09ICdsYW5ndWFnZScpIHtcbiAgICAgICAgICAgICAgICB2YWx1ZSA9IHNlbGYucHJvY2Vzc0xhbmd1YWdlQ29kZSh2YWx1ZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHNlbGYuc2V0dGluZ3Nba2V5XSA9IHZhbHVlO1xuICAgICAgICB9KTtcbiAgICB9O1xuXG4gICAgdGhpcy5nZXQgPSBmdW5jdGlvbiAoa2V5KSB7XG4gICAgICAgIHJldHVybiB0aGlzLnNldHRpbmdzW2tleV07XG4gICAgfTtcblxuICAgIHRoaXMuc2V0ID0gZnVuY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W5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgdmFyIHN1YmZlZWRzID0gY3VycmVudC5maW5kKCcuZmVlZDp2aXNpYmxlJyk7XG4gICAgICAgICAgICAgICAgaWYgKHN1YmZlZWRzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgYWN0aXZhdGVOYXZpZ2F0aW9uRW50cnkoJChzdWJmZWVkc1swXSksIG5hdmlnYXRpb25BcmVhKTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBjdXJyZW50ID0gY3VycmVudC5uZXh0KCcuZm9sZGVyJyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIG5vIHN1YmZlZWQgZm91bmRcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEZJWE1FOiBPKG4pIHJ1bnRpbWUuIElmIHNvbWVvbmUgY3JlYXRlcyBhIG5pY2UgYW5kIG5vdCBmdWdseSBzb2x1dGlvblxuICAgICAgICAvLyBwbGVhc2UgY3JlYXRlIGEgUFJcbiAgICAgICAgZm9yICh2YXIgaT0wOyBpPGVsZW1lbnRzLmxlbmd0aC0xOyBpKz0xKSB7XG4gICAgICAgICAgICB2YXIgZWxlbWVudCA9IGVsZW1lbnRzW2ldO1xuXG4gICAgICAgICAgICBpZiAoZWxlbWVudCA9PT0gY3VycmVudFswXSkge1xuICAgICAgICAgICAgICAgIHZhciBuZXh0ID0gZWxlbWVudHNbaSsxXTtcbiAgICAgICAgICAgICAgICBhY3RpdmF0ZU5hdmlnYXRpb25FbnRyeSgkKG5leHQpLCBuYXZpZ2F0aW9uQXJlYSk7XG4gICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgdmFyIGdldFBhcmVudEZvbGRlciA9IGZ1bmN0aW9uIChjdXJyZW50KSB7XG4gICA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dXJyZW50Lmhhc0NsYXNzKCdmZWVkJykpIHtcbiAgICAgICAgICAgIHZhciBwYXJlbnRGb2xkZXIgPSBnZXRQYXJlbnRGb2xkZXIoY3VycmVudCk7XG4gICAgICAgICAgICBpZiAocGFyZW50Rm9sZGVyLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICBhY3RpdmF0ZU5hdmlnYXRpb25FbnRyeShcbiAgICAgICAgICAgICAgICAgICAgcGFyZW50Rm9sZGVyLm5leHRBbGwoJy5mb2xkZXI6dmlzaWJsZScpLmZpcnN0KCksXG4gICAgICAgICAgICAgICAgICAgIG5hdmlnYXRpb25BcmVhXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgc2VsZWN0Rmlyc3RPckxhc3RGb2xkZXIobmF2aWdhdGlvbkFyZWEpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgc2VsZWN0Rmlyc3RPckxhc3RGb2xkZXIobmF2aWdhdGlvbkFyZWEpO1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIHZhciBwcmV2aW91c0ZlZWQgPSBmdW5jdGlvbiAobmF2aWdhdGlvbkFyZWEpIHtcbiAgICAgICAgdmFyIGN1cnJlbnQgPSBuYXZpZ2F0aW9uQXJlYS5maW5kKCcuYWN0aXZlJyk7XG4gICAgICAgIHZhciBlbGVtZW50cyA9IG5hdmlnYXRpb25BcmVhLmZpbmQoJy5leHBsb3JlLWZlZWQsJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy5zdWJzY3JpcHRpb25zLWZlZWQ6dmlzaWJsZSwnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLnN0YXJyZWQtZmVlZDp2aXNpYmxlLCcgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcuZmVlZDp2aXNpYmxlJyk7XG5cbiAgICAgICAgLy8gc3BlY2lhbCBjYXNlOiBmb2xkZXIgc2VsZWN0ZWRcbiAgICAgICAgaWYgKGN1cnJlbnQuaGFzQ2xhc3MoJ2ZvbGRlcicpKSB7XG4gICAgICAgICAgICB2YXIgcHJldmlvdXNGb2xkZXIgPSBjdXJyZW50LnByZXYoJy5mb2xkZXInKTtcblxuICAgICAgICAgICAgd2hpbGUgKHByZXZpb3VzRm9sZGVyLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICB2YXIgc3ViZmVlZHMgPSBwcmV2aW91c0ZvbGRlci5maW5kKCcuZmVlZDp2aXNpYmxlJyk7XG4gICAgICAgICAgICAgICAgaWYgKHN1YmZlZWRzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgYWN0aXZhdGVOYXZpZ2F0aW9uRW50cnkoJChzdWJmZWVkc1tzdWJmZWVkcy5sZW5ndGgtMV0pLFxuICAgICAgICAgICAgICAgICAgICAgICAgbmF2aWdhdGlvbkFyZWEpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHByZXZpb3VzRm9sZGVyID0gcHJldmlvdXNGb2xkZXIucHJldignLmZvbGRlcicpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBubyBzdWJmZWVkIGZvdW5kIHRyeSB2aXNpYmxlIGZlZWRzXG4gICAgICAgICAgICB2YXIgZmVlZHMgPSBjdXJyZW50LnNpYmxpbmdzKCcuZmVlZCcpO1xuXG4gICAgICAgICAgICBpZiAoZmVlZHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIGFjdGl2YXRlTmF2aWdhdGlvbkVudHJ5KCQoZmVlZHNbZmVlZHMubGVuZ3RoLTFdKSxcbiAgICAgICAgICAgICAgICAgICAgbmF2aWdhdGlvbkFyZWEpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH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gICBzY3JvbGxBcmVhLnNjcm9sbFRvcChzY3JvbGxBcmVhLnByb3AoJ3Njcm9sbEhlaWdodCcpKTtcbiAgICAgICAgfVxuXG4gICAgfTtcblxuICAgIHZhciBzY3JvbGxUb1ByZXZpb3VzSXRlbSA9IGZ1bmN0aW9uIChuYXZpZ2F0aW9uQXJlYSwgc2Nyb2xsQXJlYSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwYW5kSXRlbUluQ29tcGFjdCkge1xuICAgICAgICB2YXIgaXRlbXMgPSBzY3JvbGxBcmVhLmZpbmQoJy5pdGVtJyk7XG4gICAgICAgIHZhciBqdW1wZWQgPSBmYWxzZTtcblxuICAgICAgICBpdGVtcy5lYWNoKGZ1bmN0aW9uIChpbmRleCwgaXRlbSkge1xuICAgICAgICAgICAgaXRlbSA9ICQoaXRlbSk7XG5cbiAgICAgICAgICAgIGlmICgoaXRlbS5wb3NpdGlvbigpLnRvcCArIDEwKSA+PSAwKSB7XG4gICAgICAgICAgICAgICAgdmFyIHByZXZpb3VzID0gaXRlbS5wcmV2KCk7XG5cbiAgICAgICAgICAgICAgICAvLyBpZiB0aGVyZSBhcmUgbm8gaXRlbXMgYmVmb3JlIHRoZSBjdXJyZW50IG9uZVxuICAgICAgICAgICAgICAgIGlmIChwcmV2aW91cy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNjcm9sbFRvSXRlbShzY3JvbGxBcmVhLCBwcmV2aW91cywgZXhwYW5kSXRlbUluQ29tcGFjdCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdHJ5UmVsb2FkKG5hdmlnYXRpb25BcmVhLCBzY3JvbGxBcmVhKTtcbiAgICAgICAgICAgICAgICAgICAgc2Nyb2xsQXJlYS5zY3JvbGxUb3AoMCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAganVtcGVkID0gdHJ1ZTtcblxuICA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XG4gICAgICAgICAgICAgICAgc2Nyb2xsVG9OZXh0SXRlbShzY3JvbGxBcmVhLCBleHBhbmRJdGVtSW5Db21wYWN0KTtcblxuICAgICAgICAgICAgLy8gaywgcCwgbGVmdCBhcnJvd1xuICAgICAgICAgICAgfSBlbHNlIGlmIChbNzUsIDgwLCAzN10uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIHNjcm9sbFRvUHJldmlvdXNJdGVtKG5hdmlnYXRpb25BcmVhLCBzY3JvbGxBcmVhLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGFuZEl0ZW1JbkNvbXBhY3QpO1xuXG4gICAgICAgICAgICAvLyB1XG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs4NV0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIHRvZ2dsZVVucmVhZChzY3JvbGxBcmVhKTtcblxuICAgICAgICAgICAgLy8gZVxuICAgICAgICAgICAgfSBlbHNlIGlmIChbNjldLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICBleHBhbmRJdGVtKHNjcm9sbEFyZWEpO1xuXG4gICAgICAgICAgICAvLyBzLCBpLCBsXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs3MywgODMsIDc2XS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgdG9nZ2xlU3RhcihzY3JvbGxBcmVhKTtcblxuICAgICAgICAgICAgLy8gaFxuICAgICAgICAgICAgfSBlbHNlIGlmIChbNzJdLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICB0b2dnbGVTdGFyKHNjcm9sbEFyZWEpO1xuICAgICAgICAgICAgICAgIHNjcm9sbFRvTmV4dEl0ZW0oc2Nyb2xsQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIG9cbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzc5XS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgb3Blbkxpbmsoc2Nyb2xsQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIHJcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzgyXS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgcmVsb2FkRmVlZChuYXZpZ2F0aW9uQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIGZcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzcwXS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgbmV4dEZlZWQobmF2aWdhdGlvbkFyZWEpO1xuXG4gICAgICAgICAgICAvLyBkXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs2OF0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIHByZXZpb3VzRmVlZChuYXZpZ2F0aW9uQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIGNcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzY3XS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgcHJldmlvdXNGb2xkZXIobmF2aWdhdGlvbkFyZWEpO1xuXG4gICAgICAgICAgICAvLyBhXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs2NV0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIHNjcm9sbFRvQWN0aXZlTmF2aWdhdGlvbkVudHJ5KG5hdmlnYXRpb25BcmVhKTtcblxuICAgICAgICAgICAgLy8gdlxuICAgICAgICAgICAgfSBlbHNlIGlmIChbODZdLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICBuZXh0Rm9sZGVyKG5hdmlnYXRpb25BcmVhKTtcblxuICAgICAgICAgICAgLy8gcVxuICAgICAgICAgICAgfSBlbHNlIGlmIChbODFdLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICAkKCcjc2VhcmNoYm94JykuZm9jdXMoKTtcblxuICAgICAgICAgICAgLy8gcGFnZSB1cFxuICAgICAgICAgICAgfSBlbHNlIGlmIChbMzNdLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgdHJ5UmVsb2FkKG5hdmlnYXRpb25BcmVhLCBzY3JvbGxBcmVhKTtcblxuICAgICAgICAgICAgfVxuXG4gICAgICAgIC8vIGV2ZXJ5dGhpbmcgd2l0aCBzaGlmdFxuICAgICAgICB9IGVsc2UgaWYgKG5vSW5wdXRGb2N1c2VkKCQoJzpmb2N1cycpKSAmJiB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3BwYWJsZScsIFtcIiRyb290U2NvcGVcIiwgZnVuY3Rpb24gKCRyb290U2NvcGUpIHtcbiAgICAndXNlIHN0cmljdCc7XG5cbiAgICByZXR1cm4gZnVuY3Rpb24gKHNjb3BlLCBlbGVtLCBhdHRyKSB7XG4gICAgICAgIHZhciBkZXRhaWxzID0ge1xuICAgICAgICAgICAgYWNjZXB0OiAnLmZlZWQnLFxuICAgICAgICAgICAgaG92ZXJDbGFzczogJ2RyYWctYW5kLWRyb3AnLFxuICAgICAgICAgICAgZ3JlZWR5OiB0cnVlLFxuICAgICAgICAgICAgZHJvcDogZnVuY3Rpb24gKGV2ZW50LCB1aSkge1xuXG4gICAgICAgICAgICAgICAgJCgnLmRyYWctYW5kLWRyb3AnKS5yZW1vdmVDbGFzcygnZHJhZy1hbmQtZHJvcCcpO1xuXG4gICAgICAgICAgICAgICAgdmFyIGRhdGEgPSB7XG4gICAgICAgICAgICAgICAgICAgIGZvbGRlcklkOiBwYXJzZUludChlbGVtLmRhdGEoJ2lkJyksIDEwKSxcbiAgICAgICAgICAgICAgICAgICAgZmVlZElkOiBwYXJzZUludCgkKHVpLmRyYWdnYWJsZSkuZGF0YSgnaWQnKSwgMTApXG4gICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgICAgICRyb290U2NvcGUuJGJyb2FkY2FzdCgnbW92ZUZlZWRUb0ZvbGRlcicsIGRhdGEpO1xuICAgICAgICAgICAgICAgIHNjb3BlLiRhcHBseShhdHRyLmRyb3BwYWJsZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG5cbiAgICAgICAgZWxlbS5kcm9wcGFibGUoZGV0YWlscyk7XG4gICAgfTtcbn1dKTsiLCIvKipcbiAqIG93bkNsb3VkIC0gTmV3c1xuICpcbiAqIFRoaXMgZmlsZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgQWZmZXJvIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgdmVyc2lvbiAzIG9yXG4gKiBsYXRlci4gU2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XQgbWVhbnNcbiAgICAgICAgICAgIC8vIHRoYXQgaXQgZGlkbnQgYnJlYWsgdG8gYXV0byBwYWdlIHlldCBhbmQgdGhhdFxuICAgICAgICAgICAgLy8gdGhlcmUgYXJlIG1vcmUgaXRlbXMsIHNvIGJyZWFrXG4gICAgICAgICAgICBpZiAoY291bnRlciA+PSBsaW1pdCkge1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyB0aGlzIGlzIG9ubHkgcmVhY2hlZCB3aGVuIHRoZSBpdGVtIGlzIG5vdCBpc1xuICAgICAgICAgICAgLy8gYmVsb3cgdGhlIHRvcCBhbmQgd2UgZGlkbnQgaGl0IHRoZSBmYWN0b3IgeWV0IHNvXG4gICAgICAgICAgICAvLyBhdXRvcGFnZSBhbmQgYnJlYWtcbiAgICAgICAgICAgIGlmIChpdGVtLnBvc2l0aW9uKCkudG9wIDwgMCkge1xuICAgICAgICAgICAgICAgIHNjb3BlLiRhcHBseShzY29wZS5uZXdzU2Nyb2xsQXV0b1BhZ2UpO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBjb3VudGVyICs9IDE7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgLy8gbWFyayByZWFkXG4gICAgdmFyIG1hcmtSZWFkID0gZnVuY3Rpb24gKGVuYWJsZWQsIGVsZW0sIHNjb3BlKSB7XG4gICAgICAgIGlmIChlbmFibGVkKSB7XG4gICAgICAgICAgICB2YXIgaWRzID0gW107XG4gICAgICAgICAgICB2YXIgYXJ0aWNsZXMgPSBlbGVtLmZpbmQoJy5pdGVtOm5vdCgucmVhZCknKTtcblxuICAgICAgICAgICAgYXJ0aWNsZXMuZWFjaChmdW5jdGlvbihpbmRleCwgYXJ0aWNsZSkge1xuICAgICAgICAgICAgICAgIHZhciBpdGVtID0gJChhcnRpY2xlKTtcblxuICAgICAgICAgICAgICAgIGlmIChpdGVtLnBvc2l0aW9uKCkudG9wIDw9IC0xMCkge1xuICAgICAgICAgICAgICAgICAgICBpZHMucHVzaChwYXJzZUludChpdGVtLmRhdGEoJ2lkJyksIDEwKSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBzY29wZS5pdGVtSWRzID0gaWRzO1xuICAgICAgICAgICAgc2NvcGUuJGFwcGx5KHNjb3BlLm5ld3NTY3JvbGxNYXJrUmVhZCk7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgcmV0dXJuIHtcbiAgICAgICAgcmVzdHJpY3Q6ICdBJyxcbiAgICAgICAgc2NvcGU6IHtcbiAgICAgICAgICAgICduZXdzU2Nyb2xsJzogJ0AnLFxuICAgICAgICAgICAgJ25ld3NTY3JvbGxBdXRvUGFnZSc6ICcmJyxcbiAgICAgICAgICAgICduZXdzU2Nyb2xsTWFya1JlYWQnOiAnJicsXG4gICAgICAgICAgICAnbmV3c1Njcm9sbEVuYWJsZWRNYXJrUmVhZCc6ICc9JyxcbiAgICAgICAgfSxcbiAgICAgICAgbGluazogZnVuY3Rpb24gKHNjb3BlLCBlbGVtKSB7XG4gICAgICAgICAgICB2YXIgYWxsb3dTY3JvbGwgPSB0cnVlO1xuICAgICAgICAgICAgdmFyIHNjcm9sbEFyZWEgPSBlbGVtO1xuXG4gICAgICAgICAgICBpZiAoc2NvcGUubmV3c1Njcm9sbCkge1xuICAgICAgICAgICAgICAgIHNjcm9sbEFyZWEgPSAkKHNjb3BlLm5ld3NTY3JvbGwpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2YXIgc2Nyb2xsSGFuZGxlciA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAvLyBhbGxvdyBvbmx5IG9uZSBzY3JvbGwgZXZlbnQgdG8gdHJpZ2dlciBldmVyeSAzMDBtc1xuICAgICAgICAgICAgICAgIGlmIChhbGxvd1Njcm9sbCkge1xuICAgICAgICAgICAgICAgICAgICBhbGxvd1Njcm9sbCA9IGZhbHNlO1xuXG4gICAgICAgICAgICAgICAgICAgICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93U2Nyb2xsID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgfSwgU0NST0xMX1RJTUVPVVQqMTAwMCk7XG5cbiAgICAgICAgICAgICAgICAgICAgYXV0b1BhZ2UoSVRFTV9BVVRPX1BBR0VfU0laRSwgZWxlbSwgc2NvcGUpO1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIGRvbnQgc3RhY2sgbWFyayByZWFkIHJlcXVlc3RzXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aW1lcikge1xuICAgICAgICAgICAgICAgICAgICAgICAgJHRpbWVvdXQuY2FuY2VsKHRpbWVyKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIC8vIGFsbG93IHVzZXIgdG8gdW5kbyBhY2NpZGVudGFsIHNjcm9sbFxuICAgICAgICAgICAgICAgICAgICB0aW1lciA9ICR0aW1lb3V0KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcmtSZWFkKHNjb3BlLm5ld3NTY3JvbGxFbmFibGVkTWFya1JlYWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbGVtLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcGUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGltZXIgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgICAgIH0sIE1BUktfUkVBRF9USU1FT1VUKjEwMDApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgIHNjcm9sbEFyZWEub24oJ3Njc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2gpO1xuXG4gICAgICAgICAgICB2YXIgZG9TZWFyY2ggPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gYm94LnZhbCgpO1xuICAgICAgICAgICAgICAgIHNjb3BlLiRhcHBseShmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgIHNjb3BlLm9uU2VhcmNoKHZhbHVlKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH07XG5cbiAgICAgICAgICAgIGJveC5vbignc2VhcmNoIGtleXVwJywgZnVuY3Rpb24gKGV2ZW50KSB7XG4gICAgICAgICAgICAgICAgaWYgKGV2ZW50LnR5cGUgPT09ICdzZWFyY2gnIHx8IGV2ZW50LmtleUNvZGUgPT09IDEzKSB7XG4gICAgICAgICAgICAgICAgICAgIGRvU2VhcmNoKCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIC8vIGNhcnJ5IG92ZXIgc2VhcmNoIG9uIHJvdXRlIGNoYW5nZVxuICAgICAgICAgICAgc2NvcGUuJHdhdGNoKGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gJGxvY2F0aW9uLnNlYXJjaCgpO1xuICAgICAgICAgICAgfSwgZnVuY3Rpb24gKHNlYXJjaCkge1xuICAgICAgICAgICAgICAgIGlmIChzZWFyY2ggJiYgc2VhcmNoLnNlYXJjaCkge1xuICAgICAgICAgICAgICAgICAgICBib3gudmFsKHNlYXJjaC5zZWFyY2gpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGJveC52YWwoJycpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfTtcbn1dKTtcbiIsIi8qKlxuICogb3duQ2xvdWQgLSBOZXdzXG4gKlxuICogVGhpcyBmaWxlIGlzIGxpY2Vuc2VkIHVuZGVyIHR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Y3Q6ICdBJyxcbiAgICAgICAgc2NvcGU6IHtcbiAgICAgICAgICAgICduZXdzVG9nZ2xlU2hvdyc6ICdAJ1xuICAgICAgICB9LFxuICAgICAgICBsaW5rOiBmdW5jdGlvbiAoc2NvcGUsIGVsZW0pIHtcbiAgICAgICAgICAgIGVsZW0uY2xpY2soZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgIHZhciB0YXJnZXQgPSAkKHNjb3BlLm5ld3NUb2dnbGVTaG93KTtcbiAgICAgICAgICAgICAgICB0YXJnZXQudG9nZ2xlKCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH07XG59KTtcbiIsIi8qKlxuICogb3duQ2xvdWQgLSBOZXdzXG4gKlxuICogVGhpcyBmaWxlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBBZmZlcm8gR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2ZXJzaW9uIDMgb3JcbiAqIGxhdGVyLiBTZWUgdGhlIENPUFlJTkcgZmlsZS5cbiAqXG4gKiBAYXV0aG9yIEJlcm5oYXJkIFBvc3NlbHQgPGRldkBiZXJuaGFyZC1wb3NzZWx0LmNvbT5cbiAqIEBjb3B5cmlnaHQgQmVybmhhcmQgUG9zc2VsdCAyMDE0XG4gKi9cbmFwcC5kaXJlY3RpdmUoJ25ld3NUcmlnZ2VyQ2xpY2snLCBmdW5jdGlvbiAoKSB7XG4gICAgJ3VzZSBzdHJpY3QnO1xuXG4gICAgcmV0dXJuIGZ1bmN0aW9uIChzY29wZSwgZWxtLCBhdHRyKSB7XG4gICAgICAgIGVsbS5jbGljayhmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAkKGF0dHIubmV3c1RyaWdnZXJDbGljaykudHJpZ2dlcignY2xpY2snKTtcbiAgICAgICAgfSk7XG4gICAgfTtcblxufSk7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9 +var app=angular.module("News",["ngRoute","ngSanitize","ngAnimate"]);app.config(["$routeProvider","$provide","$httpProvider",function(e,n,r){"use strict";var i={FEED:0,FOLDER:1,STARRED:2,SUBSCRIPTIONS:3,SHARED:4,EXPLORE:5};n.constant("REFRESH_RATE",60),n.constant("ITEM_BATCH_SIZE",40),n.constant("ITEM_AUTO_PAGE_SIZE",20),n.constant("BASE_URL",OC.generateUrl("/apps/news")),n.constant("FEED_TYPE",i),n.constant("MARK_READ_TIMEOUT",.5),n.constant("SCROLL_TIMEOUT",.1),n.factory("CSRFInterceptor",["$q","BASE_URL","$window",function(e,t,n){return{request:function(r){var i=n.location.href.split(n.location.pathname)[0];return(0===r.url.indexOf(t)||0===r.url.indexOf(i))&&(r.headers.requesttoken=oc_requesttoken),r||e.when(r)}}}]);var o={0:t("news","Request failed, network connection unavailable!"),401:t("news","Request unauthorized. Are you logged in?"),403:t("news","Request forbidden. Are you an admin?"),412:t("news","Token expired or app not enabled! Reload the page!"),500:t("news","Internal server error! Please check your data/owncloud.log file for additional information!"),503:t("news","Request failed, ownCloud is in currently in maintenance mode!")};n.factory("ConnectionErrorInterceptor",["$q","$timeout",function(e,t){var n;return{responseError:function(r){return r.status in o&&(n&&t.cancel(n),OC.Notification.hide(),OC.Notification.showHtml(o[r.status]),n=t(function(){OC.Notification.hide()},5e3)),e.reject(r)}}}]),r.interceptors.push("CSRFInterceptor"),r.interceptors.push("ConnectionErrorInterceptor");var s=function(e){return{data:["$http","$route","$q","$location","BASE_URL","ITEM_BATCH_SIZE","FEED_TYPE","SettingsResource","FeedResource",function(t,n,r,i,o,s,a,u,d){var c=u.get("showAll"),l=u.get("oldestFirst"),f=i.search().search||"",h=r.defer();if(null===c||null===l)h.resolve({});else{var p={type:e,limit:s,showAll:c,oldestFirst:l,search:f};if(void 0!==n.current&&void 0!==n.current.params&&void 0!==n.current.params.id&&(p.id=n.current.params.id),e===a.FEED){var g=d.getById(p.id);void 0===g||2===g.ordering?p.oldestFirst=!1:1===g.ordering&&(p.oldestFirst=!0)}t({url:o+"/items",method:"GET",params:p}).success(function(e){h.resolve(e)})}return h.promise}]}},a=function(){return{sites:["$http","$q","BASE_URL","$location","Publisher","SettingsResource",function(e,t,n,r,i,o){var s=t.defer(),a=r.search().lang;return a||(a=o.get("language")),e.get(n+"/settings").then(function(t){i.publishAll(t);var n=o.get("exploreUrl").replace(/\/+$/,""),r=n+"/feeds."+a+".json",s=n+"/feeds.en.json";return e.get(r)["catch"](function(){return e.get(s)})}).then(function(e){s.resolve(e.data)})["catch"](function(){s.reject()}),s.promise}]}};e.when("/items",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.SUBSCRIPTIONS),type:i.SUBSCRIPTIONS}).when("/items/starred",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.STARRED),type:i.STARRED}).when("/items/feeds/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.FEED),type:i.FEED}).when("/items/folders/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:s(i.FOLDER),type:i.FOLDER}).when("/explore",{controller:"ExploreController as Explore",templateUrl:"explore.html",resolve:a(),type:i.EXPLORE}).when("/shortcuts",{templateUrl:"shortcuts.html",type:-1})}]),app.run(["$rootScope","$location","$http","$q","$interval","$route","Loading","ItemResource","FeedResource","FolderResource","SettingsResource","Publisher","BASE_URL","FEED_TYPE","REFRESH_RATE",function(e,t,n,r,i,o,s,a,u,d,c,l,f,h,p){"use strict";s.setLoading("global",!0),l.subscribe(a).toChannels(["items","newestItemId","starred"]),l.subscribe(d).toChannels(["folders"]),l.subscribe(u).toChannels(["feeds"]),l.subscribe(c).toChannels(["settings"]);var g=r.defer();n.get(f+"/settings").success(function(e){l.publishAll(e),g.resolve()});var v=r.defer(),m=t.path();n.get(f+"/feeds/active").success(function(e){var n;switch(e.activeFeed.type){case h.FEED:n="/items/feeds/"+e.activeFeed.id;break;case h.FOLDER:n="/items/folders/"+e.activeFeed.id;break;case h.STARRED:n="/items/starred";break;case h.EXPLORE:n="/explore";break;default:n="/items"}/^\/items(\/(starred|explore|feeds\/\d+|folders\/\d+))?\/?$/.test(m)||t.path(n),v.resolve()});var y,E=r.defer();n.get(f+"/feeds").success(function(e){y=e,E.resolve()});var C,F=r.defer();n.get(f+"/folders").success(function(e){C=e,F.resolve()}),r.all([E.promise,F.promise]).then(function(){l.publishAll(y),l.publishAll(C),0===y.feeds.length&&0===C.folders.length&&t.path("/explore")}),r.all([g.promise,v.promise,E.promise,F.promise]).then(function(){o.reload(),s.setLoading("global",!1)}),i(function(){n.get(f+"/feeds").success(function(e){l.publishAll(e)}),n.get(f+"/folders").success(function(e){l.publishAll(e)})},1e3*p),e.$on("$routeChangeStart",function(){s.setLoading("content",!0)}),e.$on("$routeChangeSuccess",function(){s.setLoading("content",!1)}),e.$on("$routeChangeError",function(){t.path("/items")})}]),app.controller("AppController",["Loading","FeedResource","FolderResource",function(e,t,n){"use strict";this.loading=e,this.isFirstRun=function(){return 0===t.size()&&0===n.size()},this.play=function(e){this.playingItem=e}}]),app.controller("ContentController",["Publisher","FeedResource","ItemResource","SettingsResource","data","$route","$routeParams","$location","FEED_TYPE","ITEM_AUTO_PAGE_SIZE","Loading",function(e,t,n,r,i,o,s,a,u,d,c){"use strict";n.clear(),e.publishAll(i),this.isAutoPagingEnabled=!0,n.size()>=d?this.isNothingMoreToAutoPage=!1:this.isNothingMoreToAutoPage=!0,this.getItems=function(){return n.getAll()},this.toggleStar=function(e){n.toggleStar(e)},this.toggleItem=function(e){this.isCompactView()&&(e.show=!e.show)},this.isShowAll=function(){return r.get("showAll")},this.markRead=function(e){var r=n.get(e);r.keepUnread||r.unread!==!0||(n.markItemRead(e),t.markItemOfFeedRead(r.feedId))},this.getFeed=function(e){return t.getById(e)},this.toggleKeepUnread=function(e){var r=n.get(e);r.unread||(t.markItemOfFeedUnread(r.feedId),n.markItemRead(e,!1)),r.keepUnread=!r.keepUnread};var l=this,f=function(){var e=r.get("oldestFirst");if(l.isFeed()){var n=t.getById(s.id);n&&1===n.ordering?e=!0:n&&2===n.ordering&&(e=!1)}return e};this.orderBy=function(){return f()?"id":"-id"},this.isCompactView=function(){return r.get("compact")},this.isCompactExpand=function(){return r.get("compactExpand")},this.autoPagingEnabled=function(){return this.isAutoPagingEnabled},this.markReadEnabled=function(){return!r.get("preventReadOnScroll")},this.scrollRead=function(e){var r=[],i=[];e.forEach(function(e){var t=n.get(e);t.keepUnread||(r.push(e),i.push(t.feedId))}),r.length>0&&(t.markItemsOfFeedsRead(i),n.markItemsRead(r))},this.isFeed=function(){return o.current.$$route.type===u.FEED},this.autoPage=function(){if(!this.isNothingMoreToAutoPage){if(!this.isAutoPagingEnabled)return void(this.autoPageAgain=!0);this.isAutoPagingEnabled=!1,this.autoPageAgain=!1;var t=o.current.$$route.type,i=s.id,u=f(),l=r.get("showAll"),h=this,p=a.search().search;c.setLoading("autopaging",!0),n.autoPage(t,i,u,l,p).success(function(t){e.publishAll(t),t.items.length>=d?h.isAutoPagingEnabled=!0:h.isNothingMoreToAutoPage=!0,h.isAutoPagingEnabled&&h.autoPageAgain&&h.autoPage()}).error(function(){h.isAutoPagingEnabled=!0})["finally"](function(){c.setLoading("autopaging",!1)})}},this.getRelativeDate=function(e){if(void 0!==e&&""!==e){var t=r.get("language"),n=moment.unix(e).locale(t).fromNow()+"";return n}return""},this.refresh=function(){o.reload()},this.getMediaType=function(e){return e&&0===e.indexOf("audio")?"audio":e&&0===e.indexOf("video")?"video":void 0}}]),app.controller("ExploreController",["sites","$rootScope","FeedResource","SettingsResource","$location",function(e,t,n,r,i){"use strict";this.sites=e,this.feeds=Object.keys(e).map(function(t){return[t,e[t]]}).reduce(function(e,t){var n=t[0],r=t[1];return r.forEach(function(e){e.category=n}),e.concat(r)},[]),this.feedExists=function(e){return void 0!==n.getByLocation(e)},this.subscribeTo=function(e){t.$broadcast("addFeed",e)},this.isCategoryShown=function(e){return e.filter(function(e){return void 0===n.getByLocation(e.feed)}).length>0},this.getSupportedLanguageCodes=function(){return r.getSupportedLanguageCodes()},this.getCurrentLanguageCode=function(){var e=i.search().lang;return e||(e=r.get("language")),e},this.showLanguage=function(e){i.url("/explore/?lang="+e)},this.selectedLanguageCode=this.getCurrentLanguageCode()}]),app.controller("NavigationController",["$route","FEED_TYPE","FeedResource","FolderResource","ItemResource","SettingsResource","Publisher","$rootScope","$location","$q",function(e,t,n,r,i,o,s,a,u,d){"use strict";this.feedError="",this.showNewFolder=!1,this.renamingFolder=!1,this.addingFeed=!1,this.addingFolder=!1,this.folderError="",this.renameError="",this.feed={};var c=function(){return parseInt(e.current.params.id,10)};this.getLanguageCode=function(){return o.get("language")},this.getFeeds=function(){return n.getAll()},this.getFolders=function(){return r.getAll()},this.markFolderRead=function(e){n.markFolderRead(e),n.getByFolderId(e).forEach(function(e){i.markFeedRead(e.id)})},this.markFeedRead=function(e){i.markFeedRead(e),n.markFeedRead(e)},this.markRead=function(){i.markRead(),n.markRead()},this.isShowAll=function(){return o.get("showAll")},this.getFeedsOfFolder=function(e){return n.getByFolderId(e)},this.getUnreadCount=function(){return n.getUnreadCount()},this.isUnread=function(){return this.getUnreadCount()>0},this.getFeedUnreadCount=function(e){var t=n.getById(e);return void 0!==t?t.unreadCount:0},this.isFeedUnread=function(e){return this.getFeedUnreadCount(e)>0},this.getFolderUnreadCount=function(e){return n.getFolderUnreadCount(e)},this.isFolderUnread=function(e){return this.getFolderUnreadCount(e)>0},this.getStarredCount=function(){return i.getStarredCount()},this.isStarredUnread=function(){return this.getStarredCount()>0},this.toggleFolder=function(e){r.toggleOpen(e)},this.hasFeeds=function(e){return void 0!==n.getFolderUnreadCount(e)},this.subFeedActive=function(r){var i=e.current.$$route.type;if(i===t.FEED){var o=n.getById(c());if(void 0!==o&&o.folderId===r)return!0}return!1},this.isSubscriptionsActive=function(){return e.current&&e.current.$$route.type===t.SUBSCRIPTIONS},this.isStarredActive=function(){return e.current&&e.current.$$route.type===t.STARRED},this.isExploreActive=function(){return e.current&&e.current.$$route.type===t.EXPLORE},this.isFolderActive=function(n){return e.current&&e.current.$$route.type===t.FOLDER&&c()===n},this.isFeedActive=function(n){return e.current&&e.current.$$route.type===t.FEED&&c()===n},this.folderNameExists=function(e){return e=e||"",void 0!==r.get(e.trim())},this.feedUrlExists=function(e){return e=e||"",e=e.trim(),void 0!==n.get(e)||void 0!==n.get("http://"+e)},this.createFeed=function(e){var t=this;this.showNewFolder=!1,this.addingFeed=!0;var i=e.newFolder,o=e.existingFolder||{id:0};void 0===i||""===i?(o.getsFeed=!0,n.create(e.url,o.id,void 0,e.user,e.password).then(function(e){s.publishAll(e),u.path("/items/feeds/"+e.feeds[0].id+"/")})["finally"](function(){o.getsFeed=void 0,e.url="",e.user="",e.password="",t.addingFeed=!1})):r.create(i).then(function(n){s.publishAll(n),e.existingFolder=r.get(n.folders[0].name),e.newFolder=void 0,t.createFeed(e)})},this.createFolder=function(e){var t=this;this.addingFolder=!0,r.create(e.name).then(function(e){s.publishAll(e)})["finally"](function(){t.addingFolder=!1,e.name=""})},this.moveFeed=function(t,r){var i=!1,o=n.getById(t);o.folderId!==r&&((this.isFolderActive(o.folderId)||this.isFolderActive(r))&&(i=!0),n.move(t,r),i&&e.reload())},this.renameFeed=function(e){n.patch(e.id,{title:e.title}),e.editing=!1},this.renameFolder=function(e,t){e.renameError="",this.renamingFolder=!0;var n=this;e.name===t?(e.renameError="",e.editing=!1,this.renamingFolder=!1):r.rename(e.name,t).then(function(){e.renameError="",e.editing=!1},function(t){e.renameError=t})["finally"](function(){n.renamingFolder=!1})},this.reversiblyDeleteFeed=function(t){n.reversiblyDelete(t.id)["finally"](function(){e.reload()})},this.undoDeleteFeed=function(t){n.undoDelete(t.id)["finally"](function(){e.reload()})},this.deleteFeed=function(e){n["delete"](e.url)},this.reversiblyDeleteFolder=function(t){d.all(n.reversiblyDeleteFolder(t.id),r.reversiblyDelete(t.name))["finally"](function(){e.reload()})},this.undoDeleteFolder=function(t){d.all(n.undoDeleteFolder(t.id),r.undoDelete(t.name))["finally"](function(){e.reload()})},this.deleteFolder=function(e){n.deleteFolder(e.id),r["delete"](e.name)},this.setOrdering=function(t,r){n.patch(t.id,{ordering:r}),e.reload()},this.togglePinned=function(e){var t=n.getById(e);return t?n.patch(e,{pinned:!t.pinned}):void 0},this.setUpdateMode=function(e,t){return n.patch(e,{updateMode:t})},this.toggleFullText=function(t){a.$broadcast("$routeChangeStart"),n.toggleFullText(t.id)["finally"](function(){a.$broadcast("$routeChangeSuccess"),e.reload()})},this.search=function(e){""===e?u.search("search",null):u.search("search",e)};var l=this;a.$on("moveFeedToFolder",function(e,t){l.moveFeed(t.feedId,t.folderId)});var f=function(){var i;e.current&&(i=e.current.$$route.type);var o=0;if(i===t.FOLDER)o=c();else if(i===t.FEED){var s=n.getById(c());s&&(o=s.folderId)}var a;0!==o&&(a=r.getById(o)),l.feed.existingFolder=a};a.$on("$routeChangeSuccess",function(){f()})}]),app.controller("SettingsController",["$route","$q","SettingsResource","ItemResource","OPMLParser","OPMLImporter","Publisher",function(e,t,n,r,i,o,s){"use strict";this.isOPMLImporting=!1,this.isArticlesImporting=!1,this.opmlImportError=!1,this.articleImportError=!1;var a=function(t,r){n.set(t,r),["showAll","oldestFirst","compact"].indexOf(t)>=0&&e.reload()};this.toggleSetting=function(e){a(e,!this.getSetting(e))},this.getSetting=function(e){return n.get(e)},this.importOPML=function(e){this.opmlImportError=!1,this.articleImportError=!1;try{this.isOPMLImporting=!1;var t=i.parse(e),n=this,r=5;o.importFolders(t).then(function(e){return o.importFeedQueue(e,r)})["finally"](function(){n.isOPMLImporting=!1})}catch(s){console.error(s),this.isOPMLImporting=!1,this.opmlImportError=!0}},this.importArticles=function(e){this.opmlImportError=!1,this.articleImportError=!1;try{this.isArticlesImporting=!0;var t=JSON.parse(e),n=this;r.importArticles(t).success(function(e){s.publishAll(e)})["finally"](function(){n.isArticlesImporting=!1})}catch(i){console.error(i),this.articleImportError=!0,this.isArticlesImporting=!1}}}]),app.filter("trustUrl",["$sce",function(e){"use strict";return function(t){return e.trustAsResourceUrl(t)}}]),app.filter("unreadCountFormatter",function(){"use strict";return function(e){return e>999?"999+":e}}),app.factory("FeedResource",["Resource","$http","BASE_URL","$q",function(e,t,n,r){"use strict";var i=function(t,n,r){e.call(this,t,n,"url"),this.ids={},this.locations={},this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.$q=r};return i.prototype=Object.create(e.prototype),i.prototype.receive=function(t){e.prototype.receive.call(this,t),this.updateUnreadCache(),this.updateFolderCache()},i.prototype.clear=function(){e.prototype.clear.call(this),this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.ids={},this.locations={}},i.prototype.updateUnreadCache=function(){this.unreadCount=0,this.folderUnreadCount={};var e=this;this.values.forEach(function(t){t.unreadCount&&(e.unreadCount+=t.unreadCount),void 0!==t.folderId&&(e.folderUnreadCount[t.folderId]=e.folderUnreadCount[t.folderId]||0,e.folderUnreadCount[t.folderId]+=t.unreadCount)})},i.prototype.updateFolderCache=function(){this.folderIds={};var e=this;this.values.forEach(function(t){e.folderIds[t.folderId]=e.folderIds[t.folderId]||[],e.folderIds[t.folderId].push(t)})},i.prototype.add=function(t){e.prototype.add.call(this,t),void 0!==t.id&&(this.ids[t.id]=this.hashMap[t.url]),void 0!==t.location&&(this.locations[t.location]=this.hashMap[t.url])},i.prototype.markRead=function(){this.values.forEach(function(e){e.unreadCount=0}),this.updateUnreadCache()},i.prototype.markFeedRead=function(e){this.ids[e].unreadCount=0,this.updateUnreadCache()},i.prototype.markFolderRead=function(e){this.values.forEach(function(t){t.folderId===e&&(t.unreadCount=0)}),this.updateUnreadCache()},i.prototype.markItemOfFeedRead=function(e){this.ids[e].unreadCount-=1,this.updateUnreadCache()},i.prototype.markItemsOfFeedsRead=function(e){var t=this;e.forEach(function(e){t.ids[e].unreadCount-=1}),this.updateUnreadCache()},i.prototype.markItemOfFeedUnread=function(e){this.ids[e].unreadCount+=1,this.updateUnreadCache()},i.prototype.getUnreadCount=function(){return this.unreadCount},i.prototype.getFolderUnreadCount=function(e){return this.folderUnreadCount[e]},i.prototype.getByFolderId=function(e){return this.folderIds[e]||[]},i.prototype.getById=function(e){return this.ids[e]},i.prototype.getByLocation=function(e){return this.locations[e]},i.prototype.move=function(e,t){var n=this.getById(e);return n.folderId=t,this.updateFolderCache(),this.updateUnreadCache(),this.patch(e,{folderId:t})},i.prototype.create=function(e,t,n,r,i){e=e.trim(),e.startsWith("http")||(e="https://"+e),void 0!==n&&(n=n.trim());var o={url:e,folderId:t||0,title:n||e,unreadCount:0};this.add(o),this.updateFolderCache();var s=this.$q.defer();return this.http({method:"POST",url:this.BASE_URL+"/feeds",data:{url:e,parentFolderId:t||0,title:n,user:r||null,password:i||null}}).success(function(e){s.resolve(e)}).error(function(e){o.faviconLink="",o.error=e.message,s.reject()}),s.promise},i.prototype.reversiblyDelete=function(e,t,n){var r=this.getById(e);return r&&n!==!0&&(r.deleted=!0),t!==!1&&this.updateUnreadCache(),this.http["delete"](this.BASE_URL+"/feeds/"+e)},i.prototype.reversiblyDeleteFolder=function(e){var t=this,n=[];this.getByFolderId(e).forEach(function(e){n.push(t.reversiblyDelete(e.id,!1,!0))}),this.updateUnreadCache();var r=this.$q.all(n);return r.promise},i.prototype["delete"]=function(t,n){var r=this.get(t);return void 0!==r&&r.id&&delete this.ids[r.id],void 0!==r&&r.location&&delete this.locations[r.location],e.prototype["delete"].call(this,t),n!==!1&&(this.updateUnreadCache(),this.updateFolderCache()),r},i.prototype.deleteFolder=function(e){var t=this;this.getByFolderId(e).forEach(function(e){t["delete"](e.url,!1)}),this.updateUnreadCache(),this.updateFolderCache()},i.prototype.undoDelete=function(e,t){var n=this.getById(e);return n&&(n.deleted=!1),t!==!1&&this.updateUnreadCache(),this.http.post(this.BASE_URL+"/feeds/"+e+"/restore")},i.prototype.undoDeleteFolder=function(e){var t=this,n=[];this.getByFolderId(e).forEach(function(e){n.push(t.undoDelete(e.id,!1))}),this.updateUnreadCache();var r=this.$q.all(n);return r.promise},i.prototype.setOrdering=function(e,t){var n=this.getById(e);if(n){n.ordering=t;var r=this.BASE_URL+"/feeds/"+e;return this.http.patch(r,{ordering:t})}},i.prototype.setPinned=function(e,t){var n=this.getById(e);if(n){n.pinned=t;var r=this.BASE_URL+"/feeds/"+e;return this.http.patch(r,{pinned:t})}},i.prototype.patch=function(e,t){var n=this.getById(e);if(n){Object.keys(t).forEach(function(e){n[e]=t[e]});var r=this.BASE_URL+"/feeds/"+e;return this.http.patch(r,t)}},i.prototype.toggleFullText=function(e){var t=this.getById(e);return this.patch(e,{fullTextEnabled:!t.fullTextEnabled})},new i(t,n,r)}]),app.factory("FolderResource",["Resource","$http","BASE_URL","$q",function(e,t,n,r){"use strict";var i=function(t,n,r){e.call(this,t,n,"name"),this.deleted=null,this.$q=r,this.ids={}};return i.prototype=Object.create(e.prototype),i.prototype.add=function(t){e.prototype.add.call(this,t),void 0!==t.id&&(this.ids[t.id]=this.hashMap[t.name])},i.prototype.clear=function(){e.prototype.clear.call(this),this.ids={}},i.prototype["delete"]=function(t){var n=this.get(t);return void 0!==n&&n.id&&delete this.ids[n.id],e.prototype["delete"].call(this,t),n},i.prototype.toggleOpen=function(e){var t=this.get(e);return t.opened=!t.opened,this.http({url:this.BASE_URL+"/folders/"+t.id+"/open",method:"POST",data:{folderId:t.id,open:t.opened}})},i.prototype.rename=function(e,t){var n=this.get(e),r=this.$q.defer(),i=this;return this.http({url:this.BASE_URL+"/folders/"+n.id+"/rename",method:"POST",data:{folderName:t}}).success(function(){n.name=t,delete i.hashMap[e],i.hashMap[t]=n,r.resolve()}).error(function(e){r.reject(e.message)}),r.promise},i.prototype.getById=function(e){return this.ids[e]},i.prototype.create=function(e){e=e.trim();var t={name:e};this.add(t);var n=this.$q.defer();return this.http({url:this.BASE_URL+"/folders",method:"POST",data:{folderName:e}}).success(function(e){n.resolve(e)}).error(function(e){t.error=e.message}),n.promise},i.prototype.reversiblyDelete=function(e){var t=this.get(e),n=t.id;return t.deleted=!0,this.http["delete"](this.BASE_URL+"/folders/"+n)},i.prototype.undoDelete=function(e){var t=this.get(e),n=t.id;return t.deleted=!1,this.http.post(this.BASE_URL+"/folders/"+n+"/restore")},new i(t,n,r)}]),app.factory("ItemResource",["Resource","$http","BASE_URL","ITEM_BATCH_SIZE",function(e,t,n,r){"use strict";var i=function(t,n,r){e.call(this,t,n),this.batchSize=r,this.clear()};return i.prototype=Object.create(e.prototype),i.prototype.clear=function(){this.starredCount=0,this.lowestId=0,this.highestId=0,e.prototype.clear.call(this)},i.prototype.receive=function(t,n){switch(n){case"newestItemId":this.newestItemId=t;break;case"starred":this.starredCount=t;break;default:var r=this;t.forEach(function(e){0===r.lowestId&&(r.lowestId=e.id),0===r.highestId&&(r.highestId=e.id),e.id>r.highestId&&(r.highestId=e.id),e.id<r.lowestId&&(r.lowestId=e.id)}),e.prototype.receive.call(this,t,n)}},i.prototype.getNewestItemId=function(){return this.newestItemId},i.prototype.getStarredCount=function(){return this.starredCount},i.prototype.star=function(e,t){void 0===t&&(t=!0);var n=this.get(e),r=this.BASE_URL+"/items/"+n.feedId+"/"+n.guidHash+"/star";return n.starred=t,t?this.starredCount+=1:this.starredCount-=1,this.http({url:r,method:"POST",data:{isStarred:t}})},i.prototype.toggleStar=function(e){this.get(e).starred?this.star(e,!1):this.star(e,!0)},i.prototype.markItemRead=function(e,t){return void 0===t&&(t=!0),this.get(e).unread=!t,this.http({url:this.BASE_URL+"/items/"+e+"/read",method:"POST",data:{isRead:t}})},i.prototype.markItemsRead=function(e){var t=this;return e.forEach(function(e){t.get(e).unread=!1}),this.http({url:this.BASE_URL+"/items/read/multiple",method:"POST",data:{itemIds:e}})},i.prototype.markFeedRead=function(e,t){void 0===t&&(t=!0);var n=this.values.filter(function(t){return t.feedId===e});return n.forEach(function(e){e.unread=!t}),this.http.post(this.BASE_URL+"/feeds/"+e+"/read",{highestItemId:this.getNewestItemId()})},i.prototype.markRead=function(){return this.values.forEach(function(e){e.unread=!1}),this.http({url:this.BASE_URL+"/items/read",method:"POST",data:{highestItemId:this.getNewestItemId()}})},i.prototype.autoPage=function(e,t,n,r,i){var o;return o=n?this.highestId:this.lowestId,this.http({url:this.BASE_URL+"/items",method:"GET",params:{type:e,id:t,offset:o,limit:this.batchSize,oldestFirst:n,showAll:r,search:i}})},i.prototype.importArticles=function(e){return this.http({url:this.BASE_URL+"/feeds/import/articles",method:"POST",data:{json:e}})},new i(t,n,r)}]),app.service("Loading",function(){"use strict";this.loading={global:!1,content:!1,autopaging:!1},this.setLoading=function(e,t){this.loading[e]=t},this.isLoading=function(e){return this.loading[e]}}),app.service("OPMLImporter",["FeedResource","FolderResource","Publisher","$q",function(e,t,n,r){"use strict";var i=function(o){var s=r.defer();if(o.length>0){var a=o.pop(),u=a.url,d=a.title,c=0,l=a.folderName;if(void 0!==l&&void 0!==t.get(l)){var f=t.get(l);f.opened=!0,c=f.id,f.getsFeed=!0,f.getsFeedCounter=f.getsFeedCounter||0,f.getsFeedCounter+=1}void 0!==u&&void 0===e.get(u)&&e.create(u,c,d).then(function(e){n.publishAll(e)})["finally"](function(){0!==c&&(f.getsFeedCounter-=1,0===f.getsFeedCounter&&(f.getsFeed=!1)),i(o)})}else s.resolve();return s.promise};this.importFolders=function(e){var i=[],o=[];e.folders.forEach(function(e){if(void 0!==e.name){if(void 0===t.get(e.name)){var r=t.create(e.name).then(function(e){n.publishAll(e)});o.push(r)}e.feeds.forEach(function(t){t.folderName=e.name,i.push(t)})}}),i=i.concat(e.feeds);var s=r.defer();return r.all(o)["finally"](function(){s.resolve(i)}),s.promise},this.importFeedQueue=function(e,t){for(var n=r.defer(),o=[],s=0;t>s;s+=1)o.push(i(e));return r.all(o).then(function(){n.resolve()}),n.promise}}]),app.service("OPMLParser",function(){"use strict";var e=function(e){var t=e.attr("xmlUrl")||e.attr("htmlUrl"),n=e.attr("title")||e.attr("text")||t;return void 0===t?{type:"folder",name:n,feeds:[]}:{type:"feed",name:n,url:t}},t=function(n,r,i){for(var o=0;o<n.length;o+=1){var s=$(n[o]),a=e(s);"feed"===a.type?r.feeds.push(a):i?(t(s.children("outline"),a,!1),r.folders.push(a)):t(s.children("outline"),r,!1)}return r};this.parse=function(e){e=$.parseXML(e);var n=$(e).find("body > outline"),r={feeds:[],folders:[]};return t(n,r,!0)}}),app.service("Publisher",function(){"use strict";this.channels={},this.subscribe=function(e){var t=this;return{toChannels:function(n){n.forEach(function(n){t.channels[n]=t.channels[n]||[],t.channels[n].push(e)})}}},this.publishAll=function(e){var t=this;Object.keys(e).forEach(function(n){var r=t.channels[n];void 0!==r&&r.forEach(function(t){t.receive(e[n],n)})})}}),app.factory("Resource",function(){"use strict";var e=function(e,t,n){this.id=n||"id",this.values=[],this.hashMap={},this.http=e,this.BASE_URL=t};return e.prototype.receive=function(e){var t=this;e.forEach(function(e){t.add(e)})},e.prototype.add=function(e){var t=this.hashMap[e[this.id]];void 0===t?(this.values.push(e),this.hashMap[e[this.id]]=e):Object.keys(e).forEach(function(n){t[n]=e[n]})},e.prototype.size=function(){return this.values.length},e.prototype.get=function(e){return this.hashMap[e]},e.prototype["delete"]=function(e){var t=this,n=this.values.findIndex(function(n){return n[t.id]===e});void 0!==n&&this.values.splice(n,1),void 0!==this.hashMap[e]&&delete this.hashMap[e]},e.prototype.clear=function(){for(this.hashMap={};this.values.length>0;)this.values.pop()},e.prototype.getAll=function(){return this.values},e}),app.service("SettingsResource",["$http","BASE_URL",function(e,t){"use strict";this.settings={language:"en",showAll:null,compact:!1,oldestFirst:null,preventReadOnScroll:!1,compactExpand:!1,exploreUrl:""},this.defaultLanguageCode="en",this.supportedLanguageCodes=["ar-ma","ar","bg","ca","cs","cv","da","de","el","en","en-ca","en-gb","eo","es","et","eu","fi","fr-ca","fr","gl","he","hi","hu","id","is","it","ja","ka","ko","lv","ms-my","nb","ne","nl","pl","pt-br","pt","ro","ru","sk","sl","sv","th","tr","tzm-la","tzm","uk","zh-cn","zh-tw"],this.getSupportedLanguageCodes=function(){return this.supportedLanguageCodes},this.receive=function(e){var t=this;Object.keys(e).forEach(function(n){var r=e[n];"language"===n&&(r=t.processLanguageCode(r)),t.settings[n]=r})},this.get=function(e){return this.settings[e]},this.set=function(n,r){return this.settings[n]=r,e({url:t+"/settings",method:"PUT",data:{language:this.settings.language,showAll:this.settings.showAll,compact:this.settings.compact,oldestFirst:this.settings.oldestFirst,compactExpand:this.settings.compactExpand,preventReadOnScroll:this.settings.preventReadOnScroll}})},this.processLanguageCode=function(e){return e=e.replace("_","-").toLowerCase(),this.supportedLanguageCodes.indexOf(e)<0&&(e=e.split("-")[0]),this.supportedLanguageCodes.indexOf(e)<0&&(e=this.defaultLanguageCode),e}}]),function(e,t,n,r,i,o){"use strict";var s=e.location,a=e.localStorage,u=function(e,t,r){var i=n.isContentHandlerRegistered,o=function(e,t){return i?"new"!==i(e,t):a.getItem("registeredHandler")===t};n.registerContentHandler&&!o(e,t)&&(n.registerContentHandler(e,t,r),i||a.setItem("registeredHandler",t))},d=s.protocol+"//"+s.host+s.pathname,c=d+"?subscribe_to=%s",l="application/vnd.mozilla.maybe.feed",f="ownCloud News @ "+d;u(l,c,f),i(t).ready(function(){var e=r("?subscribe_to");if(e&&"undefined"!==e){i("#new-feed").show();var t=i('input[ng-model="Navigation.feed.url"]');t.val(e),t.trigger("input"),setTimeout(function(){t.focus()},1e3)}})}(window,document,navigator,url,$),function(e,t){"use strict";e.addEventListener("beforeunload",function(){var e=t.querySelector("#app-content");e.scrollTo(0,0)})}(window,document),function(e,t,n){"use strict";var r=function(e){return!(e.is("input")||e.is("select")||e.is("textarea")||e.is("checkbox"))},i=function(e){return!(e.shiftKey||e.altKey||e.ctrlKey||e.metaKey)},o=function(e){var t=".active > .app-navigation-entry-menu .mark-read button",n=e.find(t);n.length>0&&n.trigger("click")},s=function(e,t){var n=e.offset().top-t.offset().top,r=n+e.height(),i=t.height();return n>=0&&i>r},a=function(e,t,n){0===e.length||!n&&s(e,t)||t.scrollTop(e.offset().top-t.offset().top+t.scrollTop())},u=function(e){var t=e.find(".active");a(t,e.children("ul"),!0)},d=function(e){e.find(".active > a:visible").trigger("click")},c=function(e,t){if(0===t.scrollTop()){var n=t.find(".pull-to-refresh");n.hasClass("show-pull-to-refresh")?n.hasClass("done")&&d(e):n.addClass("show-pull-to-refresh")}},l=function(e,t){e.children("a:visible").trigger("click"),a(e,t.children("ul"))},f=function(e){var t=e.find(".active"),r=e.find(".explore-feed,.subscriptions-feed:visible,.starred-feed:visible,.feed:visible");if(t.hasClass("folder"))for(;t.length>0;){var i=t.find(".feed:visible");if(i.length>0)return void l(n(i[0]),e);t=t.next(".folder")}else for(var o=0;o<r.length-1;o+=1){var s=r[o];if(s===t[0]){var a=r[o+1];l(n(a),e);break}}},h=function(e){return e.parent().parent(".folder")},p=function(e,t){var r,i=e.find(".folder:visible");r=t?i.length-1:0,i.length>0&&l(n(i[r]),e)},g=function(e){var t=e.find(".active");if(t.hasClass("folder"))l(t.prevAll(".folder:visible").first(),e);else if(t.hasClass("feed")){var n=h(t);n.length>0?l(n,e):p(e,!0)}else p(e,!0)},v=function(e){var t=e.find(".active");if(t.hasClass("folder"))l(t.nextAll(".folder:visible").first(),e);else if(t.hasClass("feed")){var n=h(t);n.length>0?l(n.nextAll(".folder:visible").first(),e):p(e)}else p(e)},m=function(e){var t=e.find(".active"),r=e.find(".explore-feed,.subscriptions-feed:visible,.starred-feed:visible,.feed:visible");if(t.hasClass("folder")){for(var i=t.prev(".folder");i.length>0;){var o=i.find(".feed:visible");if(o.length>0)return void l(n(o[o.length-1]),e);i=i.prev(".folder")}var s=t.siblings(".feed");if(s.length>0)return void l(n(s[s.length-1]),e);var a=n(".starred-feed:visible");return void(a.length>0&&l(a,e))}for(var u=r.length-1;u>0;u-=1){var d=r[u];if(d===t[0]){var c=r[u-1];l(n(c),e);break}}},y=function(e,t){var r=e.find(".item");r.each(function(e,r){return r=n(r),r.height()+r.position().top>30?(t(r),!1):void 0})},E=function(e){y(e,function(e){e.find(".toggle-keep-unread").trigger("click")})},C=function(e){y(e,function(e){e.find(".star").trigger("click")})},F=function(e){y(e,function(e){e.find(".utils").trigger("click")})},I=function(t){y(t,function(t){t.trigger("click"),e.open(t.find(".external:visible").attr("href"),"_blank")})},w=function(e,t,n){e.scrollTop(t.offset().top-e.offset().top+e.scrollTop()),n&&y(e,function(e){e.hasClass("open")||e.find(".utils").trigger("click")})},R=function(e,t){var r=e.find(".item"),i=!1;r.each(function(r,o){return o=n(o),0===o.position().top&&t&&!o.hasClass("open")||o.position().top>10?(w(e,o,t),i=!0,!1):void 0}),i||e.scrollTop(e.prop("scrollHeight"))},b=function(e,t,r){var i=t.find(".item"),o=!1;i.each(function(i,s){if(s=n(s),s.position().top+10>=0){var a=s.prev();return a.length>0?w(t,a,r):(c(e,t),t.scrollTop(0)),o=!0,!1}}),!o&&i.length>0&&w(t,i.last())};n(t).keyup(function(e){var t=e.keyCode,s=n("#app-content"),a=n("#app-navigation"),l=n("#articles.compact").length>0,h="true"===n("#articles").attr("news-compact-expand"),p=l&&h;r(n(":focus"))&&i(e)?[74,78,39].indexOf(t)>=0?(e.preventDefault(), +R(s,p)):[75,80,37].indexOf(t)>=0?(e.preventDefault(),b(a,s,p)):[85].indexOf(t)>=0?(e.preventDefault(),E(s)):[69].indexOf(t)>=0?(e.preventDefault(),F(s)):[73,83,76].indexOf(t)>=0?(e.preventDefault(),C(s)):[72].indexOf(t)>=0?(e.preventDefault(),C(s),R(s)):[79].indexOf(t)>=0?(e.preventDefault(),I(s)):[82].indexOf(t)>=0?(e.preventDefault(),d(a)):[70].indexOf(t)>=0?(e.preventDefault(),f(a)):[68].indexOf(t)>=0?(e.preventDefault(),m(a)):[67].indexOf(t)>=0?(e.preventDefault(),g(a)):[65].indexOf(t)>=0?(e.preventDefault(),u(a)):[86].indexOf(t)>=0?(e.preventDefault(),v(a)):[81].indexOf(t)>=0?(e.preventDefault(),n("#searchbox").focus()):[33].indexOf(t)>=0&&c(a,s):r(n(":focus"))&&e.shiftKey&&[65].indexOf(t)>=0&&(e.preventDefault(),o(a))})}(window,document,$),window.News=window.News||{},function(e,t,n,r,i){"use strict";var o=[];r.addArticleAction=function(e){o.push(e)},r.getArticleActionPlugins=function(){return o}}(window,document,jQuery,window.News),app.run(["$document","$rootScope",function(e,t){"use strict";e.click(function(e){t.$broadcast("documentClicked",e)})}]),app.directive("appNavigationEntryUtils",function(){"use strict";return{restrict:"C",link:function(e,t){var n=t.siblings(".app-navigation-entry-menu"),r=$(t).find(".app-navigation-entry-utils-menu-button button");r.click(function(){n.toggleClass("open")}),e.$on("documentClicked",function(e,t){t.target!==r[0]&&n.removeClass("open")})}}}),app.directive("newsAddFeed",["$rootScope","$timeout",function(e,t){"use strict";return{restrict:"A",link:function(n,r){e.$on("addFeed",function(e,i){t(function(){r.is(":animated")?(r.stop(!0,!0),r.show()):r.is(":visible")||r.slideDown(),r.find('[ng-model="Navigation.feed.url"]').focus()}),n.Navigation.feed.url=i})}}}]),app.directive("newsArticleActions",function(){"use strict";return{restrict:"A",scope:{newsArticleActions:"=",noPlugins:"="},link:function(e,t){for(var n=News.getArticleActionPlugins(),r=0;r<n.length;r+=1)n[r](t,e.newsArticleActions);e.noPlugins=0===n.length}}}),app.directive("newsAutoFocus",["$timeout",function(e){"use strict";return function(t,n,r){var i=n;r.newsAutoFocus&&(i=$(r.newsAutoFocus)),e(function(){i.focus()},0)}}]),app.directive("newsBindHtmlUnsafe",function(){"use strict";return function(e,t,n){e.$watch(n.newsBindHtmlUnsafe,function(){t.html(e.$eval(n.newsBindHtmlUnsafe))})}}),app.directive("newsDraggable",function(){"use strict";return function(e,t,n){var r=e.$eval(n.newsDraggable);angular.isDefined(r)?t.draggable(r):t.draggable(),n.$observe("newsDraggableDisable",function(e){"true"===e?t.draggable("disable"):t.draggable("enable")})}}),app.directive("newsDroppable",["$rootScope",function(e){"use strict";return function(t,n,r){var i={accept:".feed",hoverClass:"drag-and-drop",greedy:!0,drop:function(i,o){$(".drag-and-drop").removeClass("drag-and-drop");var s={folderId:parseInt(n.data("id"),10),feedId:parseInt($(o.draggable).data("id"),10)};e.$broadcast("moveFeedToFolder",s),t.$apply(r.droppable)}};n.droppable(i)}}]),app.directive("newsFinishedTransition",function(){"use strict";return function(e,t,n){t.on("transitionend",function(){t.addClass(n.newsFinishedTransition)})}}),app.directive("newsFocus",["$timeout","$interpolate",function(e,t){"use strict";return function(n,r,i){r.click(function(){var r=$(t(i.newsFocus)(n));e(function(){r.focus()},500)})}}]),app.directive("newsInstantNotification",function(){"use strict";return{restrict:"E",link:function(e,t){t.hide();var n=t.html();OC.Notification.showHtml(n)}}}),app.directive("newsPlayOne",["$rootScope",function(e){"use strict";return{restrict:"A",link:function(t,n){n.on("play",function(){e.$broadcast("playing",n)}),e.$on("playing",function(e,t){t[0]!==n[0]&&n[0].pause()})}}}]),app.directive("newsPullToRefresh",["$rootScope",function(e){"use strict";var t=!1;return{restrict:"A",scope:{newsPullToRefresh:"="},link:function(n,r){e.$on("$routeChangeStart",function(){t=!1,n.newsPullToRefresh=!1}),r.on("scroll",function(){0===r.scrollTop()&&t&&(n.newsPullToRefresh=!0),t=!0})}}}]),app.directive("newsReadFile",function(){"use strict";return function(e,t,n){t.change(function(){var r=t[0].files[0],i=new FileReader;i.onload=function(t){e.$fileContent=t.target.result,e.$apply(n.newsReadFile)},i.readAsText(r)})}}),app.directive("newsRefreshMasonry",["$timeout",function(e){"use strict";var t=function(t){e(function(){e(function(){t.parent().masonry({itemSelector:".grid-item",gutter:25,columnWidth:300})},100)})};return function(e,n){e.$last&&t(n)}}]),app.directive("newsScroll",["$timeout","ITEM_AUTO_PAGE_SIZE","MARK_READ_TIMEOUT","SCROLL_TIMEOUT",function(e,t,n,r){"use strict";var i,o=function(e,t,n){for(var r=0,i=t.find(".item"),o=i.length-1;o>=0;o-=1){var s=$(i[o]);if(r>=e)break;if(s.position().top<0){n.$apply(n.newsScrollAutoPage);break}r+=1}},s=function(e,t,n){if(e){var r=[],i=t.find(".item:not(.read)");i.each(function(e,t){var n=$(t);return n.position().top<=-10?void r.push(parseInt(n.data("id"),10)):!1}),n.itemIds=r,n.$apply(n.newsScrollMarkRead)}};return{restrict:"A",scope:{newsScroll:"@",newsScrollAutoPage:"&",newsScrollMarkRead:"&",newsScrollEnabledMarkRead:"="},link:function(a,u){var d=!0,c=u;a.newsScroll&&(c=$(a.newsScroll));var l=function(){d&&(d=!1,e(function(){d=!0},1e3*r),o(t,u,a),i&&e.cancel(i),i=e(function(){s(a.newsScrollEnabledMarkRead,u,a),i=void 0},1e3*n))};c.on("scroll",l),a.$on("$destroy",function(){c.off("scroll",l)})}}}]),app.directive("newsSearch",["$document","$location",function(e,t){"use strict";return{restrict:"E",scope:{onSearch:"="},link:function(e){var n=$("#searchbox");n.val(t.search().search);var r=function(){var t=n.val();e.$apply(function(){e.onSearch(t)})};n.on("search keyup",function(e){("search"===e.type||13===e.keyCode)&&r()}),e.$watch(function(){return t.search()},function(e){e&&e.search?n.val(e.search):n.val("")})}}}]),app.directive("newsStickyMenu",function(){"use strict";return function(e,t,n){var r=40;$(n.newsStickyMenu).scroll(function(){var e=$(this).scrollTop();e>r?(t.addClass("fixed"),t.css("top",e)):t.removeClass("fixed")})}}),app.directive("newsStopPropagation",function(){"use strict";return{restrict:"A",link:function(e,t){t.bind("click",function(e){e.stopPropagation()})}}}),app.directive("newsTimeout",["$timeout","$rootScope",function(e,t){"use strict";return{restrict:"A",scope:{newsTimeout:"&"},link:function(n,r){var i=!1,o=7,s=e(n.newsTimeout,1e3*o);n.$on("$destroy",function(){i=!0,e.cancel(s)}),t.$on("$locationChangeStart",function(){e.cancel(s),i||(i=!0,r.remove(),n.newsTimeout())})}}}]),app.directive("newsTitleUnreadCount",["$window",function(e){"use strict";var t=e.document.title,n=t.split("-"),r=n[0]||"News",i=n[1]||"ownCloud";return{restrict:"E",scope:{unreadCount:"@"},link:function(t,n,o){o.$observe("unreadCount",function(t){"0"!==t?e.document.title=r+"("+t+") - "+i:e.document.title=r+" - "+i})}}}]),app.directive("newsToggleShow",function(){"use strict";return{restrict:"A",scope:{newsToggleShow:"@"},link:function(e,t){t.click(function(){var t=$(e.newsToggleShow);t.toggle()})}}}),app.directive("newsTriggerClick",function(){"use strict";return function(e,t,n){t.click(function(){$(n.newsTriggerClick).trigger("click")})}}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFwcC5qcyIsIkNvbmZpZy5qcyIsIlJ1bi5qcyIsIkFwcENvbnRyb2xsZXIuanMiLCJDb250ZW50Q29udHJvbGxlci5qcyIsIkV4cGxvcmVDb250cm9sbGVyLmpzIiwiTmF2aWdhdGlvbkNvbnRyb2xsZXIuanMiLCJTZXR0aW5nc0NvbnRyb2xsZXIuanMiLCJUcnVzdFVybC5qcyIsIlVucmVhZENvdW50Rm9ybWF0dGVyLmpzIiwiRmVlZFJlc291cmNlLmpzIiwiRm9sZGVyUmVzb3VyY2UuanMiLCJJdGVtUmVzb3VyY2UuanMiLCJMb2FkaW5nLmpzIiwiT1BNTEltcG9ydGVyLmpzIiwiT1BNTFBhcnNlci5qcyIsIlB1Ymxpc2hlci5qcyIsIlJlc291cmNlLmpzIiwiU2V0dGluZ3NSZXNvdXJjZS5qcyIsIkV4dGVyblN1YnNjcmlwdGlvbi5qcyIsIkZpeGVzLmpzIiwiS2V5Ym9hcmRTaG9ydGN1dHMuanMiLCJBcnRpY2xlQWN0aW9uUGx1Z2luLmpzIiwiQXBwTmF2aWdhdGlvbkVudHJ5VXRpbHMuanMiLCJOZXdzQWRkRmVlZC5qcyIsIk5ld3NBcnRpY2xlQWN0aW9ucy5qcyIsIk5ld3NBdXRvRm9jdXMuanMiLCJOZXdzQmluZFVuc2FmZUh0bWwuanMiLCJOZXdzRHJhZ2dhYmxlLmpzIiwiTmV3c0Ryb3BwYWJsZS5qcyIsIk5ld3NGaW5pc2hlZFRyYW5zaXRpb24uanMiLCJOZXdzRm9jdXMuanMiLCJOZXdzSW5zdGFudE5vdGlmaWNhdGlvbi5qcyIsIk5ld3NQbGF5T25lLmpzIiwiTmV3c1B1bGxUb1JlZnJlc2guanMiLCJOZXdzUmVhZEZpbGUuanMiL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VfVVJMLCAkd2luZG93KSB7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICByZXF1ZXN0OiBmdW5jdGlvbiAoY29uZmlnKSB7XG4gICAgICAgICAgICAgICAgdmFyIGRvbWFpbiA9XG4gICAgICAgICAgICAgICAgICAgICR3aW5kb3cubG9jYXRpb24uaHJlZi5zcGxpdCgkd2luZG93LmxvY2F0aW9uLnBhdGhuYW1lKVswXTtcbiAgICAgICAgICAgICAgICBpZiAoY29uZmlnLnVybC5pbmRleE9mKEJBU0VfVVJMKSA9PT0gMCB8fFxuICAgICAgICAgICAgICAgICAgICBjb25maWcudXJsLmluZGV4T2YoZG9tYWluKSA9PT0gMCkge1xuICAgICAgICAgICAgICAgICAgICAvKmpzaGludCBjYW1lbGNhc2U6IGZhbHNlICovXG4gICAgICAgICAgICAgICAgICAgIGNvbmZpZy5oZWFkZXJzLnJlcXVlc3R0b2tlbiA9IG9jX3JlcXVlc3R0b2tlbjtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gY29uZmlnIHx8ICRxLndoZW4oY29uZmlnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICB9XSk7XG4gICAgdmFyIGVycm9yTWVzc2FnZXMgPSB7XG4gICAgICAgIDA6IHQoJ25ld3MnLCAnUmVxdWVzdCBmYWlsZWQsIG5ldHdvcmsgY29ubmVjdGlvbiB1bmF2YWlsYWJsZSEnKSxcbiAgICAgICAgNDAxOiB0KCduZXdzJywgJ1JlcXVlc3QgdW5hdXRob3JpemVkLiBBcmUgeW91IGxvZ2dlZCBpbj8nKSxcbiAgICAgICAgNDAzOiB0KCduZXdzJywgJ1JlcXVlc3QgZm9yYmlkZGVuLiBBcmUgeW91IGFuIGFkbWluPycpLFxuICAgICAgICA0MTI6IHQoJ25ld3MnLCAnVG9rZW4gZXhwaXJlZCBvciBhcHAgbm90IGVuYWJsZWQhIFJlbG9hZCB0aGUgcGFnZSEnKSxcbiAgICAgICAgNTAwOiB0KCduZXdzJywgJ0ludGVybmFsIHNlcnZlciBlcnJvciEgUGxlYXNlIGNoZWNrIHlvdXIgJyArXG4gICAgICAgICAgICAgICAgICAgICAgICdkYXRhL293bmNsb3VkLmxvZyBmaWxlIGZvciBhZGRpdGlvbmFsICcgK1xuICAgICAgICAgICAgICAgICAgICAgICAnaW5mb3JtYXRpb24hJyksXG4gICAgICAgIDUwMzogdCgnbmV3cycsICdSZXF1ZXN0IGZhaWxlZCwgb3duQ2xvdWQgaXMgaW4gY3VycmVudGx5ICcgK1xuICAgICAgICAgICAgICAgICAgICAgICAnaW4gbWFpbnRlbmFuY2UgbW9kZSEnKSxcbiAgICB9O1xuICAgICRwcm92aWRlLmZhY3RvcnkoJ0Nvbm5lY3Rpb25FcnJvckludGVyY2VwdG9yJywgW1wiJHFcIiwgXCIkdGltZW91dFwiLCBmdW5jdGlvbiAoJHEsICR0aW1lb3V0KSB7XG4gICAgICAgIHZhciB0aW1lcjtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgIHJlc3BvbnNlRXJyb3I6IGZ1bmN0aW9uIChyZXNwb25zZSkge1xuICAgICAgICAgICAgICAgIC8vIHN0YXR1cyAwIGlzIGEgbmV0d29yayBlcnJvclxuICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZS5zdGF0dXMgaW4gZXJyb3JNZXNzYWdlcykge1xuICAgICAgICAgICAgICAgICAgICBpZiAodGltZXIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICR0aW1lb3V0LmNhbmNlbCh0aW1lcik7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgT0MuTm90aWZpY2F0aW9uLmhpZGUoKTtcbiAgICAgICAgICAgICAgICAgICAgT0MuTm90aWZpY2F0aW9uLnNob3dIdG1sKGVycm9yTWVzc2FnZXNbcmVzcG9uc2Uuc3RhdHVzXSk7XG4gICAgICAgICAgICAgICAgICAgIHRpbWVyID0gJHRpbWVvdXQ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ICAgICAgICAgdmFyIG9sZGVzdEZpcnN0ID0gU2V0dGluZ3NSZXNvdXJjZS5nZXQoJ29sZGVzdEZpcnN0Jyk7XG4gICAgICAgICAgICAgICAgdmFyIHNlYXJjaCA9ICRsb2NhdGlvbi5zZWFyY2goKS5zZWFyY2ggfHwgJyc7XG5cbiAgICAgICAgICAgICAgICB2YXIgZGVmZXJyZWQgPSAkcS5kZWZlcigpO1xuXG4gICAgICAgICAgICAgICAgLy8gaWYgdGhvc2UgdHdvIHZhbHVlcyBhcmUgbnVsbCBpdCBtZWFucyB3ZSBkaWQgbm90IHJlY2VpdmVcbiAgICAgICAgICAgICAgICAvLyB0aGUgc2V0dGluZ3MgcmVxdWVzdCBmcm9tIHRoZSBzZXJ2ZXIgc28gZG9udCBxdWVyeSB0aGUgc2VydmVyXG4gICAgICAgICAgICAgICAgaWYgKHNob3dBbGwgPT09IG51bGwgfHwgb2xkZXN0Rmlyc3QgPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVmZXJyZWQucmVzb2x2ZSh7fSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBhcmFtZXRlcnMgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiB0eXBlLFxuICAgICAgICAgICAgICAgICAgICAgICAgbGltaXQ6IElURU1fQkFUQ0hfU0laRSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNob3dBbGw6IHNob3dBbGwsXG4gICAgICAgICAgICAgICAgICAgICAgICBvbGRlc3RGaXJzdDogb2xkZXN0Rmlyc3QsXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWFyY2g6IHNlYXJjaFxuICAgICAgICAgICAgICAgICAgICB9O1xuXG4gICAgICAgICAgICAgICAgICAgIGlmICgkcm91dGUuY3VycmVudCAhPT0gdW5kZWZpbmVkICYmXG4gICAgICAgICAgICAgICAgICAgICAgICAkcm91dGUuY3VycmVudC5wYXJhbXMgIT09IHVuZGVmaW5lZCAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgJHJvdXRlLmN1cnJlbnQucGFyYW1zLmlkICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlcnMuaWQgPSAkcm91dGUuY3VycmVudC5wYXJhbXMuaWQ7XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAvLyBjaGVjayBpZiBhIGN1c3RvbSBvcmRlcmluZyBpcyBzZXRcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGUgPT09IEZFRURfVFlQRS5GRUVEKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgZmVlZCA9IEZlZWRSZXNvdXJjZS5nZXRCeUlkKHBhcmFtZXRlcnMuaWQpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBvbiBpbnRpYWwgbG9hZCwgdGhlIGZlZWQgb3JkZXJpbmcgaXMgdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmVlZCA9PT0gdW5kZWZpbmVkIHx8IGZlZWQub3JkZXJpbmcgPT09IDIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJzLm9sZGVzdEZpcnN0ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGZlZWQub3JkZXJpbmcgPT09IDEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJzLm9sZGVzdEZpcnN0ID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICRodHRwKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogIEJBU0VfVVJMICsgJy9pdGVtcycsXG4gICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdHRVQnLFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zOiBwYXJhbWV0ZXJzXG4gICAgICAgICAgICAgICAgICAgIH0pLnN1Y2Nlc3MoZnVuY3Rpb24gKGRhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUoZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZC5wcm9taXNlO1xuICAgICAgICAgICAgfV1cbiAgICAgICAgfTtcbiAgICB9O1xuXG4gICAgdmFyIGdldEV4cGxvcmVSZXNvbHZlID0gZnVuY3Rpb24gKCkge1xuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgc2l0ZXM6IC8qIEBuZ0luamVjdCAqLyBbXCIkaHR0cFwiLCBcIiRxXCIsIFwiQkFTRV9VUkxcIiwgXCIkbG9jYXRpb25cIiwgXCJQdWJsaXNoZXJcIiwgXCJTZXR0aW5nc1Jlc291cmNlXCIsIGZ1bmN0aW9uIChcbiAgICAgICAgICAgICRodHRwLCAkcSwgQkFTRV9VUkwsICRsb2NhdGlvbiwgUHVibGlzaGVyLCBTZXR0aW5nc1Jlc291cmNlKSB7XG4gICAgICAgICAgICAgICAgdmFyIGRlZmVycmVkID0gJHEuZGVmZXIoKTtcblxuICAgICAgICAgICAgICAgIC8vIGFsd2F5cyB1c2UgdGhlIGNvZGUgZnJvbSB0aGUgdXJsXG4gICAgICAgICAgICAgICAgdmFyIGxhbmd1YWdlID0gJGxvY2F0aW9uLnNlYXJjaCgpLmxhbmc7XG4gICAgICAgICAgICAgICAgaWYgKCFsYW5ndWFnZSkge1xuICAgICAgICAgICAgICAgICAgICBsYW5ndWFnZSA9IFNldHRpbmdzUmVzb3VyY2UuZ2V0KCdsYW5ndWFnZScpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICRodHRwLmdldChCQVNFX1VSTCArICcvc2V0dGluZ3MnKS50aGVuKGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgICAgICAgICAgICAgIFB1Ymxpc2hlci5wdWJsaXNoQWxsKGRhdGEpO1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIGdldCB1cmwgYW5kIHN0cmlwIHRyYWlsaW5nIHNsYXNoZXNcbiAgICAgICAgICAgICAgICAgICAgdmFyIHVybCA9IFNldHRpbmdzUmVzb3VyY2UuZ2V0KCdleHBsb3JlVXJsJylcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKC9cXC8rJC8sICcnKTtcblxuICAgICAgICAgICAgICAgICAgICB2YXIgZXhwbG9yZVVybCA9IHVybCArICcvZmVlZHMuJyArIGxhbmd1YWdlICsgJy5qc29uJztcbiAgICAgICAgICAgICAgICAgICAgdmFyIGRlZmF1bHRFeHBsb3JlVXJsID0gdXJsICsgJy9mZWVkcy5lbi5qc29uJztcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICRodHRwXG4gICAgICAgICAgICAgICAgICAgICAgICAuZ2V0KGV4cGxvcmVVcmwpXG4gICAgICAgICAgICAgICAgICAgICAgICAuY2F0Y2goZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkaHR0cC5nZXQoZGVmYXVsdEV4cGxvcmVVcmwpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUoZGF0YS5kYXRhKTtcbiAgICAgICAgICAgICAgICB9KS5jYXRjaChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlamVjdCgpO1xuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG4gICAgICAgICAgICB9XVxuICAgICAgICB9O1xuICAgIH07XG5cbiAgICAkcm91dGVQcm92aWRlclxuICAgICAgICAud2hlbignL2l0ZW1zJywge1xuICAgICAgICAgICAgY29udHJvbGxlcjogJ0NvbnRlbnRDb250cm9sbGVyIGFzIENvbnRlbnQnLFxuICAgICAgICAgICAgdGVtcGxhdGVVcmw6ICdjb250ZW50Lmh0bWwnLFxuICAgICAgICAgICAgcmVzb2x2ZTogZ2V0SXRlbVJlc29sdmUoZmVlZFR5cGUuU1VCU0NSSVBUSU9OUyksXG4gICAgICAgICAgICB0eXBlOiBmZWVkVHlwZS5TVUJTQ1JJUFRJT05TXG4gICAgICAgIH0pXG4gICAgICAgIC53aGVuKCcvaXRlbXMvc3RhcnJlZCcsIHtcbiAgICAgICAgICAgIGNvbnRyb2xsZXI6ICdDb250ZW50Q29udHJvbGxlciBhcyBDb250ZW50JyxcbiAgICAgICAgICAgIHRlbXBsYXRlVXJsOiAnY29udGVudC5odG1sJyxcbiAgICAgICAgICAgIHJlc29sdmU6IGdldEl0ZW1SZXNvbHZlKGZlZWRUeXBlLlNUQVJSRUQpLFxuICAgICAgICAgICAgdHlwZTogZmVlZFR5cGUuU1RBUlJFRFxuICAgICAgICB9KVxuICAgICAgICAud2hlbignL2l0ZW1zL2ZlZWRzLzppZCcsIHtcbiAgICAgICAgICAgIGNvbnRyb2xsZXI6ICdDb250ZW50Q29udHJvbGxlciBhcyBDb250ZW50JyxcbiAgICAgICAgICAgIHRlbXBsYXRlVXJsOiAnY29udGVudC5odG1sJyxcbiAgICAgICAgICAgIHJlc29sdmU6IGdldEl0ZW1SZXNvbHZlKGZlZWRUeXBlLkZFRUQpLFxuICAgICAgICAgICAgdHlwZTogZmVlZFR5cGUuRkVFRFxuICAgICAgICB9KVxuICAgICAgICAud2hlbignL2l0ZW1zL2ZvbGRlcnMvOmlkJywge1xuICAgICAgICAgICAgY29udHJvbGxlcjogJ0NvbnRlbnRDb250cm9sbGVyIGFzIENvbnRlbnQnLFxuICAgICAgICAgICAgdGVtcGx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5lZWQgdG8gY3JlYXRlIGEgbmV3IGZvbGRlclxuICAgICAgICBpZiAobmV3Rm9sZGVyID09PSB1bmRlZmluZWQgfHwgbmV3Rm9sZGVyID09PSAnJykge1xuICAgICAgICAgICAgLy8gdGhpcyBpcyBzZXQgdG8gZGlzcGxheSB0aGUgZmVlZCBpbiBhbnkgZm9sZGVyLCBldmVuIGlmIHRoZSBmb2xkZXJcbiAgICAgICAgICAgIC8vIGlzIGNsb3NlZCBvciBoYXMgbm8gdW5yZWFkIGFydGljbGVzXG4gICAgICAgICAgICBleGlzdGluZ0ZvbGRlci5nZXRzRmVlZCA9IHRydWU7XG5cbiAgICAgICAgICAgIEZlZWRSZXNvdXJjZS5jcmVhdGUoZmVlZC51cmwsIGV4aXN0aW5nRm9sZGVyLmlkLCB1bmRlZmluZWQsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZlZWQudXNlciwgZmVlZC5wYXNzd29yZClcbiAgICAgICAgICAgIC50aGVuKGZ1bmN0aW9uIChkYXRhKSB7XG5cbiAgICAgICAgICAgICAgICBQdWJsaXNoZXIucHVibGlzaEFsbChkYXRhKTtcblxuICAgICAgICAgICAgICAgIC8vIHNldCBmb2xkZXIgYXMgZGVmYXVsdFxuICAgICAgICAgICAgICAgICRsb2NhdGlvbi5wYXRoKCcvaXRlbXMvZmVlZHMvJyArIGRhdGEuZmVlZHNbMF0uaWQgKyAnLycpO1xuXG4gICAgICAgICAgICB9KS5maW5hbGx5KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICBleGlzdGluZ0ZvbGRlci5nZXRzRmVlZCA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICBmZWVkLnVybCA9ICcnO1xuICAgICAgICAgICAgICAgIGZlZWQudXNlciA9ICcnO1xuICAgICAgICAgICAgICAgIGZlZWQucGFzc3dvcmQgPSAnJztcbiAgICAgICAgICAgICAgICBzZWxmLmFkZGluZ0ZlZWQgPSBmYWxzZTtcbiAgICAgICAgIC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gICB0aGlzLmlkcyA9IHt9O1xuICAgICAgICB0aGlzLmxvY2F0aW9ucyA9IHt9O1xuICAgICAgICB0aGlzLnVucmVhZENvdW50ID0gMDtcbiAgICAgICAgdGhpcy5mb2xkZXJVbnJlYWRDb3VudCA9IHt9O1xuICAgICAgICB0aGlzLmZvbGRlcklkcyA9IHt9O1xuICAgICAgICB0aGlzLiRxID0gJHE7XG4gICAgfTtcblxuICAgIEZlZWRSZXNvdXJjZS5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKFJlc291cmNlLnByb3RvdHlwZSk7XG5cbiAgICBGZWVkUmVzb3VyY2UucHJvdG90eXBlLnJlY2VpdmUgPSBmdW5jdGlvbiAoZGF0YSkge1xuICAgICAgICBSZXNvdXJjZS5wcm90b3R5cGUucmVjZWl2ZS5jYWxsKHRoaXMsIGRhdGEpO1xuICAgICAgICB0aGlzLnVwZGF0ZVVucmVhZENhY2hlKCk7XG4gICAgICAgIHRoaXMudXBkYXRlRm9sZGVyQ2FjaGUoKTtcbiAgICB9O1xuXG4gICAgRmVlZFJlc291cmNlLnByb3RvdHlwZS5jbGVhciA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgUmVzb3VyY2UucHJvdG90eXBlLmNsZWFyLmNhbGwodGhpcyk7XG4gICAgICAgIHRoaXMudW5yZWFkQ291bnQgPSAwO1xuICAgICAgICB0aGlzLmZvbGRlclVucmVhZENvdW50ID0ge307XG4gICAgICAgIHRoaXMuZm9sZGVySWRzID0ge307XG4gICAgICAgIHRoaXMuaWRzID0ge307XG4gICAgICAgIHRoaXMubG9jYXRpb25zID0ge307XG4gICAgfTtcblxuICAgIEZlZWRSZXNvdXJjZS5wcm90b3R5cGUudXBkYXRlVW5yZWFkQ2FjaGUgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHRoaXMudW5yZWFkQ291bnQgPSAwO1xuICAgICAgICB0aGlzLmZvbGRlclVucmVhZENvdW50ID0ge307XG5cbiAgICAgICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgICAgICB0aGlzLnZhbHVlcy5mb3JFYWNoKGZ1bmN0aW9uIChmZWVkKSB7XG4gICAgICAgICAgICBpZiAoZmVlZC51bnJlYWRDb3VudCkge1xuICAgICAgICAgICAgICAgIHNlbGYudW5yZWFkQ291bnQgKz0gZmVlZC51bnJlYWRDb3VudDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChmZWVkLmZvbGRlcklkICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmZvbGRlclVucmVhZENvdW50W2ZlZWQuZm9sZGVySWRdID1cbiAgICAgICAgICAgICAgICAgICAgc2VsZi5mb2xkZXJVbnJlYWRDb3VudFtmZWVkLmZvbGRlcklkXSB8fCAwO1xuICAgICAgICAgICAgICAgIHNlbGYuZm9sZGVyVW5yZWFkQ291bnRbZmVlZC5mb2xkZXJJZF0gKz0gZmVlZC51bnJlYWRDb3VudDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfTtcblxuXG4gICAgRmVlZFJlc291cmNlLnByb3RvdHlwZS51cGRhdGVGb2xkZXJDYWNoZSA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdGhpcy5mb2xkZXJJZHMgPSB7fTtcblxuICAgICAgICB2YXIgc2VsZiA9IHRoaXM7XG4gICAgICAgIHRoaXMudmFsdWVzLmZvckVhY2goZnVuY3Rpb24gKGZlZWQpIHtcbiAgICAgICAgICAgIHNlbGYuZm9sZGVySWRzW2ZlZWQuZm9sZGVySWRdID1cbiAgICAgICAgICAgICAgICBzZWxmLmZvbGRlcklkc1tmZWVkLmZvbGRlcklkXSB8fCBbXTtcbiAgICAgICAgICAgIHNlbGYuZm9sZGVySWRzW2ZlZWQuZm9sZGVySWRdLnB1c2goZmVlZCk7XG4gICAgICAgIH0pO1xuICAgIH07XG5cblxuICAgIEZlZWRSZXNvdXJjZS5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gKHZhbHVlKS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gICAgICAgICAgICAgICAgICAgICAgcGFzc3dvcmQpIHtcbiAgICAgICAgdXJsID0gdXJsLnRyaW0oKTtcbiAgICAgICAgaWYgKCF1cmwuc3RhcnRzV2l0aCgnaHR0cCcpKSB7XG4gICAgICAgICAgICB1cmwgPSAnaHR0cHM6Ly8nICsgdXJsO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRpdGxlICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIHRpdGxlID0gdGl0bGUudHJpbSgpO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGZlZWQgPSB7XG4gICAgICAgICAgICB1cmw6IHVybCxcbiAgICAgICAgICAgIGZvbGRlcklkOiBmb2xkZXJJZCB8fCAwLFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlIHx8IHVybCxcbiAgICAgICAgICAgIHVucmVhZENvdW50OiAwXG4gICAgICAgIH07XG5cbiAgICAgICAgdGhpcy5hZGQoZmVlZCk7XG4gICAgICAgIHRoaXMudXBkYXRlRm9sZGVyQ2FjaGUoKTtcblxuICAgICAgICB2YXIgZGVmZXJyZWQgPSB0aGlzLiRxLmRlZmVyKCk7XG5cbiAgICAgICAgdGhpcy5odHRwKHtcbiAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxuICAgICAgICAgICAgdXJsOiB0aGlzLkJBU0VfVVJMICsgJy9mZWVkcycsXG4gICAgICAgICAgICBkYXRhOiB7XG4gICAgICAgICAgICAgICAgdXJsOiB1cmwsXG4gICAgICAgICAgICAgICAgcGFyZW50Rm9sZGVySWQ6IGZvbGRlcklkIHx8IDAsXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxuICAgICAgICAgICAgICAgIHVzZXI6IHVzZXIgfHwgbnVsbCxcbiAgICAgICAgICAgICAgICBwYXNzd29yZDogcGFzc3dvcmQgfHwgbnVsbFxuICAgICAgICAgICAgfVxuICAgICAgICB9KS5zdWNjZXNzKGZ1bmN0aW9uIChkYXRhKSB7XG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nc3RhcnJlZCc6XG4gICAgICAgICAgICB0aGlzLnN0YXJyZWRDb3VudCA9IHZhbHVlO1xuICAgICAgICAgICAgYnJlYWs7XG5cbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgICAgIHZhbHVlLmZvckVhY2goZnVuY3Rpb24gKGl0ZW0pIHtcbiAgICAgICAgICAgICAgICAvLyBpbml0aWFsaXplIGxvd2VzdCBhbmQgaGlnaGVzdCBpZFxuICAgICAgICAgICAgICAgIGlmIChzZWxmLmxvd2VzdElkID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlbGYubG93ZXN0SWQgPSBpdGVtLmlkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoc2VsZi5oaWdoZXN0SWQgPT09IDApIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5oaWdoZXN0SWQgPSBpdGVtLmlkO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChpdGVtLmlkID4gc2VsZi5oaWdoZXN0SWQpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5oaWdoZXN0SWQgPSBpdGVtLmlkO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoaXRlbS5pZCA8IHNlbGYubG93ZXN0SWQpIHtcbiAgICAgICAgICAgICAgICAgICAgc2VsZi5sb3dlc3RJZCA9IGl0ZW0uaWQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIFJlc291cmNlLnByb3RvdHlwZS5yZWNlaXZlLmNhbGwodGhpcywgdmFsdWUsIGNoYW5uZWwpO1xuICAgICAgICB9XG4gICAgfTtcblxuXG4gICAgSXRlbVJlc291cmNlLnByb3RvdHlwZS5nZXROZXdlc3RJdGVtSWQgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLm5ld2VzdEl0ZW1JZDtcbiAgICB9O1xuXG5cbiAgICBJdGVtUmVzb3VyY2UucHJvdG90eXBlLmdldFN0YXJyZWRDb3VudCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnJlZENvdW50O1xuICAgIH07XG5cblxuICAgIEl0ZW1SZXNvdXJjZS5wcm90b3R5cGUuc3RhciA9IGZ1bmN0aW9uIChpdGVtSWQsIGlzU3RhcnJlZCkge1xuICAgICAgICBpZiAoaXNTdGFycmVkID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIGlzU3RhcnJlZCA9IHRydWU7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgaXQgPSB0aGlzLmdldChpdGVtSWQpO1xuICAgICAgICB2YXIgdXJsID0gdGhpcy5CQVNFX1VSTCArXG4gICAgICAgICAgICAnL2l0ZW1zLycgKyBpdC5mZWVkSWQgKyAnLycgKyBpdC5ndWlkSGFzaCArICcvc3Rhcic7XG5cbiAgICAgICAgaXQuc3RhcnJlZCA9IGlzU3RhcnJlZDtcblxuICAgICAgICBpZiAoaXNTdGFycmVkKSB7XG4gICAgICAgICAgICB0aGlzLnN0YXJyZWRDb3VudCArPSAxO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy5zdGFycmVkQ291bnQgLT0gMTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiB0aGlzLmh0dHAoe1xuICAgICAgICAgICAgdXJsOiB1cmwsXG4gICAgICAgICAgICBtZXRob2Q6ICdQT1NUJyxcbiAgICAgICAgICAgIGRhdGE6IHtcbiAgICAgICAgICAgICAgICBpc1N0YXJyZWQ6IGlzU3RhcnJlZFxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9O1xuXG5cbiAgICBJdGVtUmVzb3VyY2UucHJvdG90eXBlLnRvZ2dsZVN0YXIgPSBmdW5jdGlvbiAoaXRlbUlkKSB7XG4gICAgICAgIGlmICh0aGlzLmdldChpdGVtSWQpLnN0YXJyZWQpIHtcbiAgICAgICAgICAgIHRoaXMuc3RhcihpdGVtSWQsIGZhbHNlKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRoaXMuc3RhcihpdGVtSWQsIHRydWUpO1xuICAgICAgICB9XG4gICAgfTtcblxuXG4gICAgSXRlbVJlc291cmNlLnByb3RvdHlwZS5tYXJrSXRlbVJlYWQgPSBmdW5jdGlvbiAoaXRlbUlkLCBpc1JlYWQpIHtcbiAgICAgICAgaWYgKGlzUmVhZCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICBpc1JlYWQgPSB0cnVlO1xuICAgICAgICB9XG5cbiAgICAgICAgdGhpcy5nZXQoaXRlbUlkKS51bnJlYWQgPSAhaXNSZWFkO1xuXG4gICAgICAgIHJldHVybiB0aGlzLmh0dHAoe1xuICAgICAgICAgICAgdXJsOiB0aGlzLkJBU0VfVVJMICsgJy9pdGVtcy8nICsgaXRlbUlkICsgJy9yZWFkJyxcbiAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxuICAgICAgICAgICAgZGF0YToge1xuICAgICAgICAgICAgICAgIGlzUmVhZDogaXNSZWFkXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgIH07XG5cblxuICAgIEl0ZW1SZXNvdXJjZS5wcm90b3R5cGUubWFya0l0ZW1zUmVhZCA9IGZ1bmN0aW9uIChpdGVtSWRzKSB7XG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcblxuICAgICAgICBpdGVtSWRzLmZvckVhY2goZnVuY3Rpb24oaXRlbUlkKSB7XG4gICAgICAgICAgICBzZWxmLmdldChpdGVtSWQpLnVucmVhZCA9IGZhbHNlO1xuICAgICAgICB9KTtcblxuICAgICAgICByZXR1cm4gdGhpcy5odHRwKHtcbiAgICAgICAgICAgIHVybDogdGhpcy5CQVNFX1VSTCArICcvaXRlbXMvcmVhZC9tdWx0aXBsZScsXG4gICAgICAgICAgICBtZXRob2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gICBpZiAoZm9sZGVyTmFtZSAhPT0gdW5kZWZpbmVkICYmXG4gICAgICAgICAgICAgICAgRm9sZGVyUmVzb3VyY2UuZ2V0KGZvbGRlck5hbWUpICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICB2YXIgZm9sZGVyID0gRm9sZGVyUmVzb3VyY2UuZ2V0KGZvbGRlck5hbWUpO1xuICAgICAgICAgICAgICAgIGZvbGRlci5vcGVuZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIGZvbGRlcklkID0gZm9sZGVyLmlkO1xuXG4gICAgICAgICAgICAgICAgLy8gZGlzcGxheSBmb2xkZXIgd2hpbGUgYWRkaW5nIHRoZSBmZWVkXG4gICAgICAgICAgICAgICAgZm9sZGVyLmdldHNGZWVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICBmb2xkZXIuZ2V0c0ZlZWRDb3VudGVyID0gZm9sZGVyLmdldHNGZWVkQ291bnRlciB8fCAwO1xuICAgICAgICAgICAgICAgIGZvbGRlci5nZXRzRmVlZENvdW50ZXIgKz0gMTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gbWFrZSBzdXJlIHRvIG5vdCBhZGQgYWxyZWFkeSBleGlzdGluZyBmZWVkc1xuICAgICAgICAgICAgaWYgKHVybCAhPT0gdW5kZWZpbmVkICYmIEZlZWRSZXNvdXJjZS5nZXQodXJsKSA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgRmVlZFJlc291cmNlLmNyZWF0ZSh1cmwsIGZvbGRlcklkLCB0aXRsZSlcbiAgICAgICAgICAgICAgICAudGhlbihmdW5jdGlvbiAoZGF0YSkge1xuICAgICAgICAgICAgICAgICAgICBQdWJsaXNoZXIucHVibGlzaEFsbChkYXRhKTtcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC5maW5hbGx5KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGZvbGRlcklkICE9PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBmb2xkZXIuZ2V0c0ZlZWRDb3VudGVyIC09IDE7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmb2xkZXIuZ2V0c0ZlZWRDb3VudGVyID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9sZGVyLmdldHNGZWVkID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgc3RhcnRGZWVkSm9iKHF1ZXVlKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUoKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBkZWZlcnJlZC5wcm9taXNlO1xuICAgIH07XG5cbiAgICB0aGlzLmltcG9ydEZvbGRlcnMgPSBmdW5jdGlvbiAoY29udGVudCkge1xuICAgICAgICAvLyBhc3N1bXB0aW9uOiBmb2xkZXJzIGFyZSBmYXN0IHRvIGNyZWF0ZSBhbmQgd2UgZG9udCBuZWVkIGEgcXVldWUgZm9yXG4gICAgICAgIC8vIHRoZW1cbiAgICAgICAgdmFyIGZlZWRRdWV1ZSA9IFtdO1xuICAgICAgICB2YXIgZm9sZGVyUHJvbWlzZXMgPSBbXTtcbiAgICAgICAgY29udGVudC5mb2xkZXJzLmZvckVhY2goZnVuY3Rpb24gKGZvbGRlcikge1xuICAgICAgICAgICAgaWYgKGZvbGRlci5uYW1lICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAvLyBza2lwIGFscmVhZHkgY3JlYXRlZCBmb2xkZXJzXG4gICAgICAgICAgICAgICAgaWYgKEZvbGRlclJlc291cmNlLmdldChmb2xkZXIubmFtZSkgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgcHJvbWlzZSA9IEZvbGRlclJlc291cmNlLmNyZWF0ZShmb2xkZXIubmFtZSlcbiAgICAgICAgICAgICAgICAgICAgLnRoZW4oZnVuY3Rpb24gKGRhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFB1Ymxpc2hlci5wdWJsaXNoQWxsKGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgZm9sZGVyUHJvbWlzZXMucHVzaChwcm9taXNlKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBmb2xkZXIuZmVlZHMuZm9yRWFjaChmdW5jdGlvbiAoZmVlZCkge1xuICAgICAgICAgICAgICAgICAgICBmZWVkLmZvbGRlck5hbWUgPSBmb2xkZXIubmFtZTtcbiAgICAgICAgICAgICAgICAgICAgZmVlZFF1ZXVlLnB1c2goZmVlZCk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICBmZWVkUXVldWUgPSBmZWVkUXVldWUuY29uY2F0KGNvbnRlbnQuZmVlZHMpO1xuXG4gICAgICAgIHZhciBkZWZlcnJlZCA9ICRxLmRlZmVyKCk7XG5cbiAgICAgICAgJHEuYWxsKGZvbGRlclByb21pc2VzKS5maW5hbGx5KGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIGRlZmVycmVkLnJlc29sdmUoZmVlZFF1ZXVlKTtcbiAgICAgICAgfSk7XG5cbiAgICAgICAgcmV0dXJuIGRlZmVycmVkLnByb21pc2U7XG4gICAgfTtcblxuICAgIHRoaXMuaW1wb3J0RmVlZFF1ZXVlID0gZnVuY3Rpb24gKGZlZWRRdWV1ZSwgam9iU2l6ZSkge1xuICAgICAgICAvLyBxdWV1ZSBmZWVkcyB0byBwcmV2ZW50IHNlcnZlciBzbG93ZG93blxuICAgICAgICB2YXIgZGVmZXJyZWQgPSAkcS5kZWZlcigpO1xuXG4gICAgICAgIHZhciBqb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xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICB0eXBlOiAnZm9sZGVyJyxcbiAgICAgICAgICAgICAgICBuYW1lOiBuYW1lLFxuICAgICAgICAgICAgICAgIGZlZWRzOiBbXVxuICAgICAgICAgICAgfTtcblxuICAgICAgICAvLyBmZWVkXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIHR5cGU6ICdmZWVkJyxcbiAgICAgICAgICAgICAgICBuYW1lOiBuYW1lLFxuICAgICAgICAgICAgICAgIHVybDogdXJsXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfTtcblxuICAgIC8vIHRoZXJlIGlzIG9ubHkgb25lIGxldmVsLCBzbyBmZWVkcyBpbiBhIGZvbGRlciBpbiBhIGZvbGRlciBzaG91bGQgYmVcbiAgICAvLyBhdHRhY2hlZCB0byB0aGUgcm9vdCBmb2xkZXJcbiAgICB2YXIgcmVjdXJzaXZlbHlQYXJzZSA9IGZ1bmN0aW9uIChsZXZlbCwgcm9vdCwgZmlyc3RMZXZlbCkge1xuICAgICAgICBmb3IgKHZhciBpPTA7IGk8bGV2ZWwubGVuZ3RoOyBpKz0xKSB7XG4gICAgICAgICAgICB2YXIgb3V0bGluZSA9ICQobGV2ZWxbaV0pO1xuXG4gICAgICAgICAgICB2YXIgZW50cnkgPSBwYXJzZU91dGxpbmUob3V0bGluZSk7XG5cbiAgICAgICAgICAgIGlmIChlbnRyeS50eXBlID09PSAnZmVlZCcpIHtcbiAgICAgICAgICAgICAgICByb290LmZlZWRzLnB1c2goZW50cnkpO1xuICAgICAgICAgICAgfSBlbHNlIHtcblxuICAgICAgICAgICAgICAgIC8vIG9ubHkgZmlyc3QgbGV2ZWwgc2hvdWxkIGFwcGVuZCBmb2xkZXJzXG4gICAgICAgICAgICAgICAgaWYgKGZpcnN0TGV2ZWwpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVjdXJzaXZlbHlQ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gICAgaWYgKGV4aXN0aW5nID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgIHRoaXMudmFsdWVzLnB1c2gob2JqKTtcbiAgICAgICAgICAgIHRoaXMuaGFzaE1hcFtvYmpbdGhpcy5pZF1dID0gb2JqO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy8gY29weSB2YWx1ZXMgZnJvbSBuZXcgdG8gb2xkIG9iamVjdCBpZiBpdCBleGlzdHMgYWxyZWFkeVxuICAgICAgICAgICAgT2JqZWN0LmtleXMob2JqKS5mb3JFYWNoKGZ1bmN0aW9uIChrZXkpIHtcbiAgICAgICAgICAgICAgICBleGlzdGluZ1trZXldID0gb2JqW2tleV07XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH07XG5cblxuICAgIFJlc291cmNlLnByb3RvdHlwZS5zaXplID0gZnVuY3Rpb24gKCkge1xuICAgICAgICByZXR1cm4gdGhpcy52YWx1ZXMubGVuZ3RoO1xuICAgIH07XG5cblxuICAgIFJlc291cmNlLnByb3RvdHlwZS5nZXQgPSBmdW5jdGlvbiAoaWQpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuaGFzaE1hcFtpZF07XG4gICAgfTtcblxuXG4gICAgUmVzb3VyY2UucHJvdG90eXBlLmRlbGV0ZSA9IGZ1bmN0aW9uIChpZCkge1xuICAgICAgICAvLyBmaW5kIGluZGV4IG9mIG9iamVjdCB0aGF0IHNob3VsZCBiZSBkZWxldGVkXG4gICAgICAgIHZhciBzZWxmID0gdGhpcztcbiAgICAgICAgdmFyIGRlbGV0ZUF0SW5kZXggPSB0aGlzLnZhbHVlcy5maW5kSW5kZXgoZnVuY3Rpb24oZWxlbWVudCkge1xuICAgICAgICAgICAgcmV0dXJuIGVsZW1lbnRbc2VsZi5pZF0gPT09IGlkO1xuICAgICAgICB9KTtcblxuICAgICAgICBpZiAoZGVsZXRlQXRJbmRleCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICB0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HtcbiAgICAgICAgZWxlbWVudC5jaGlsZHJlbignYTp2aXNpYmxlJykudHJpZ2dlcignY2xpY2snKTtcbiAgICAgICAgc2Nyb2xsVG9OYXZpZ2F0aW9uRWxlbWVudChlbGVtZW50LCBuYXZpZ2F0aW9uQXJlYS5jaGlsZHJlbigndWwnKSk7XG4gICAgfTtcblxuICAgIHZhciBuZXh0RmVlZCA9IGZ1bmN0aW9uIChuYXZpZ2F0aW9uQXJlYSkge1xuICAgICAgICB2YXIgY3VycmVudCA9IG5hdmlnYXRpb25BcmVhLmZpbmQoJy5hY3RpdmUnKTtcbiAgICAgICAgdmFyIGVsZW1lbnRzID0gbmF2aWdhdGlvbkFyZWEuZmluZCgnLmV4cGxvcmUtZmVlZCwnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLnN1YnNjcmlwdGlvbnMtZmVlZDp2aXNpYmxlLCcgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcuc3RhcnJlZC1mZWVkOnZpc2libGUsJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy5mZWVkOnZpc2libGUnKTtcblxuICAgICAgICBpZiAoY3VycmVudC5oYXNDbGFzcygnZm9sZGVyJykpIHtcbiAgICAgICAgICAgIHdoaWxlIChjdXJyZW50Lmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICB2YXIgc3ViZmVlZHMgPSBjdXJyZW50LmZpbmQoJy5mZWVkOnZpc2libGUnKTtcbiAgICAgICAgICAgICAgICBpZiAoc3ViZmVlZHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBhY3RpdmF0ZU5hdmlnYXRpb25FbnRyeSgkKHN1YmZlZWRzWzBdKSwgbmF2aWdhdGlvbkFyZWEpO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGN1cnJlbnQ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SxcbiAgICAgICAgICAgICAgICAgICAgbmF2aWdhdGlvbkFyZWFcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBzZWxlY3RGaXJzdE9yTGFzdEZvbGRlcihuYXZpZ2F0aW9uQXJlYSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBzZWxlY3RGaXJzdE9yTGFzdEZvbGRlcihuYXZpZ2F0aW9uQXJlYSk7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgdmFyIHByZXZpb3VzRmVlZCA9IGZ1bmN0aW9uIChuYXZpZ2F0aW9uQXJlYSkge1xuICAgICAgICB2YXIgY3VycmVudCA9IG5hdmlnYXRpb25BcmVhLmZpbmQoJy5hY3RpdmUnKTtcbiAgICAgICAgdmFyIGVsZW1lbnRzID0gbmF2aWdhdGlvbkFyZWEuZmluZCgnLmV4cGxvcmUtZmVlZCwnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLnN1YnNjcmlwdGlvbnMtZmVlZDp2aXNpYmxlLCcgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICcuc3RhcnJlZC1mZWVkOnZpc2libGUsJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJy5mZWVkOnZpc2libGUnKTtcblxuICAgICAgICAvLyBzcGVjaWFsIGNhc2U6IGZvbGRlciBzZWxlY3RlZFxuICAgICAgICBpZiAoY3VycmVudC5oYXNDbGFzcygnZm9sZGVyJykpIHtcbiAgICAgICAgICAgIHZhciBwcmV2aW91c0ZvbGRlciA9IGN1cnJlbnQucHJldignLmZvbGRlcicpO1xuXG4gICAgICAgICAgICB3aGlsZSAocHJldmlvdXNGb2xkZXIubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgIHZhciBzdWJmZWVkcyA9IHByZXZpb3VzRm9sZGVyLmZpbmQoJy5mZWVkOnZpc2libGUnKTtcbiAgICAgICAgICAgICAgICBpZiAoc3ViZmVlZHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgICAgICAgICBhY3RpdmF0ZU5hdmlnYXRpb25FbnRyeSgkKHN1YmZlZWRzW3N1YmZlZWRzLmxlbmd0aC0xXSksXG4gICAgICAgICAgICAgICAgICAgICAgICBuYXZpZ2F0aW9uQXJlYSk7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcHJldmlvdXNGb2xkZXIgPSBwcmV2aW91c0ZvbGRlci5wcmV2KCcuZm9sZGVyJyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIG5vIHN1YmZlZWQgZm91bmQgdHJ5IHZpc2libGUgZmVlZHNcbiAgICAgICAgICAgIHZhciBmZWVkcyA9IGN1cnJlbnQuc2libGluZ3MoJy5mZWVkJyk7XG5cbiAgICAgICAgICAgIGlmIChmZWVkcy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgYWN0aXZhdGVOYXZpZ2F0aW9uRW50cnkoJChmZWVkc1tmZWVkcy5sZW5ndGgtMV0pLFxuICAgICAgICAgICAgICAgICAgICBuYXZpZ2F0aW9uQXJlYSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuXG5cbiAgICAgICAgICAgIC8vIG5vIGZlZWQgZm91bmQsIGdvIHRvIHN0YXJyZWRcbiAgICAgICAgICAgIHZhciBzdGFycmVkID0gJCgnLnN0YXJyZWQtZmVlZDp2aXNpYmxlJyk7XG4gICAgICAgICAgICBpZiAoc3RhcnJlZC5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAgICAgYWN0aXZhdGVOYXZpZ2F0aW9uRW50cnkoc3RhcnJlZCwgbmF2aWdhdGlvbkFyZWEpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm47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m9sbEFyZWEuZmluZCgnLml0ZW0nKTtcbiAgICAgICAgdmFyIGp1bXBlZCA9IGZhbHNlO1xuXG4gICAgICAgIGl0ZW1zLmVhY2goZnVuY3Rpb24gKGluZGV4LCBpdGVtKSB7XG4gICAgICAgICAgICBpdGVtID0gJChpdGVtKTtcblxuICAgICAgICAgICAgaWYgKChpdGVtLnBvc2l0aW9uKCkudG9wICsgMTApID49IDApIHtcbiAgICAgICAgICAgICAgICB2YXIgcHJldmlvdXMgPSBpdGVtLnByZXYoKTtcblxuICAgICAgICAgICAgICAgIC8vIGlmIHRoZXJlIGFyZSBubyBpdGVtcyBiZWZvcmUgdGhlIGN1cnJlbnQgb25lXG4gICAgICAgICAgICAgICAgaWYgKHByZXZpb3VzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgc2Nyb2xsVG9JdGVtKHNjcm9sbEFyZWEsIHByZXZpb3VzLCBleHBhbmRJdGVtSW5Db21wYWN0KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0cnlSZWxvYWQobmF2aWdhdGlvbkFyZWEsIHNjcm9sbEFyZWEpO1xuICAgICAgICAgICAgICAgICAgICBzY3JvbGxBcmVhLnNjcm9sbFRvcCgwKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBqdW1wZWQgPSB0cnVlO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICAvLyBpZiB0aGVyZSB3YXMgbm8ganVtcCBqdW1wIHRvIHRoZSBsYXN0IGVsZW1lbnRcbiAgICAgICAgaWYgKCFqdW1wZWQgJiYgaXRlbXMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgc2Nyb2xsVG9JdGVtKHNjcm9sbEFyZWEsIGl0ZW1zLmxhc3QoKSk7XG4gICAgICAgIH1cbiAgICB9O1xuXG5cbiAgICAkKGRv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91c0l0ZW0obmF2aWdhdGlvbkFyZWEsIHNjcm9sbEFyZWEsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwYW5kSXRlbUluQ29tcGFjdCk7XG5cbiAgICAgICAgICAgIC8vIHVcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzg1XS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgdG9nZ2xlVW5yZWFkKHNjcm9sbEFyZWEpO1xuXG4gICAgICAgICAgICAvLyBlXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs2OV0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIGV4cGFuZEl0ZW0oc2Nyb2xsQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIHMsIGksIGxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzczLCA4MywgNzZdLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICB0b2dnbGVTdGFyKHNjcm9sbEFyZWEpO1xuXG4gICAgICAgICAgICAvLyBoXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs3Ml0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIHRvZ2dsZVN0YXIoc2Nyb2xsQXJlYSk7XG4gICAgICAgICAgICAgICAgc2Nyb2xsVG9OZXh0SXRlbShzY3JvbGxBcmVhKTtcblxuICAgICAgICAgICAgLy8gb1xuICAgICAgICAgICAgfSBlbHNlIGlmIChbNzldLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICBvcGVuTGluayhzY3JvbGxBcmVhKTtcblxuICAgICAgICAgICAgLy8gclxuICAgICAgICAgICAgfSBlbHNlIGlmIChbODJdLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICByZWxvYWRGZWVkKG5hdmlnYXRpb25BcmVhKTtcblxuICAgICAgICAgICAgLy8gZlxuICAgICAgICAgICAgfSBlbHNlIGlmIChbNzBdLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICBuZXh0RmVlZChuYXZpZ2F0aW9uQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIGRcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzY4XS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgcHJldmlvdXNGZWVkKG5hdmlnYXRpb25BcmVhKTtcblxuICAgICAgICAgICAgLy8gY1xuICAgICAgICAgICAgfSBlbHNlIGlmIChbNjddLmluZGV4T2Yoa2V5Q29kZSkgPj0gMCkge1xuXG4gICAgICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgICAgICBwcmV2aW91c0ZvbGRlcihuYXZpZ2F0aW9uQXJlYSk7XG5cbiAgICAgICAgICAgIC8vIGFcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoWzY1XS5pbmRleE9mKGtleUNvZGUpID49IDApIHtcblxuICAgICAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICAgICAgc2Nyb2xsVG9BY3RpdmVOYXZpZ2F0aW9uRW50cnkobmF2aWdhdGlvbkFyZWEpO1xuXG4gICAgICAgICAgICAvLyB2XG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs4Nl0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIG5leHRGb2xkZXIobmF2aWdhdGlvbkFyZWEpO1xuXG4gICAgICAgICAgICAvLyBxXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFs4MV0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgICQoJyNzZWFyY2hib3gnKS5mb2N1cygpO1xuXG4gICAgICAgICAgICAvLyBwYWdlIHVwXG4gICAgICAgICAgICB9IGVsc2UgaWYgKFszM10uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICB0cnlSZWxvYWQobmF2aWdhdGlvbkFyZWEsIHNjcm9sbEFyZWEpO1xuXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgLy8gZXZlcnl0aGluZyB3aXRoIHNoaWZ0XG4gICAgICAgIH0gZWxzZSBpZiAobm9JbnB1dEZvY3VzZWQoJCgnOmZvY3VzJykpICYmIGV2ZW50LnNoaWZ0S2V5KSB7XG5cbiAgICAgICAgICAgIC8vIHNoaWZ0ICsgYVxuICAgICAgICAgICAgaWYgKFs2NV0uaW5kZXhPZihrZXlDb2RlKSA+PSAwKSB7XG5cbiAgICAgICAgICAgICAgICBldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuICAgICAgICAgICAgICAgIG1hcmtBbGxSZWFkKG5hdmlnYXRpb25BcmVhKTtcblxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSk7XG5cbn0od2luZG93LCBkb2N1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cbiAqIGxhdGVyLiBTZWUgdGhlIENPUFlJTkcgZmlsZS5cbiAqXG4gKiBAYXV0aG9yIEJlcm5oYXJkIFBvc3NlbHQgPGRldkBiZXJuaGFyZC1wb3NzZWx0LmNvbT5cbiAqIEBjb3B5cmlnaHQgQmVybmhhcmQgUG9zc2VsdCAyMDE0XG4gKi9cbmFwcC5kaXJlY3RpdmUoJ25ld3NBZGRGZWVkJywgW1wiJHJvb3RTY29wZVwiLCBcIiR0aW1lb3V0XCIsIGZ1bmN0aW9uICgkcm9vdFNjb3BlLCAkdGltZW91dCkge1xuICAgICd1c2Ugc3RyaWN0JztcblxuICAgIHJldHVybiB7XG4gICAgICAgIHJlc3RyaWN0OiAnQScsXG4gICAgICAgIGxpbms6IGZ1bmN0aW9uIChzY29wZSwgZWxlbSkge1xuICAgICAgICAgICAgJHJvb3RTY29wZS4kb24oJ2FkZEZlZWQnLCBmdW5jdGlvbiAoXywgdXJsKSB7XG5cbiAgICAgICAgICAgICAgICAkdGltZW91dChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChlbGVtLmlzKCc6YW5pbWF0ZWQnKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZWxlbS5zdG9wKHRydWUsIHRydWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZWxlbS5zaG93KCk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIWVsZW0uaXMoJzp2aXNpYmxlJykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGVsZW0uc2xpZGVEb3duKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgZWxlbS5maW5kKCdbbmctbW9kZWw9XCJOYXZpZ2F0aW9uLmZlZWQudXJsXCJdJykuZm9jdXMoKTtcbiAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgIHNjb3BlLk5hdmlnYXRpb24uZmVlZC51cmwgPSB1cmw7XG4gICAgICAgICA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7XG4gICAgICAgICAgICBzY29wZS4kYXBwbHkoc2NvcGUubmV3c1Njcm9sbE1hcmtSZWFkKTtcbiAgICAgICAgfVxuICAgIH07XG5cbiAgICByZXR1cm4ge1xuICAgICAgICByZXN0cmljdDogJ0EnLFxuICAgICAgICBzY29wZToge1xuICAgICAgICAgICAgJ25ld3NTY3JvbGwnOiAnQCcsXG4gICAgICAgICAgICAnbmV3c1Njcm9sbEF1dG9QYWdlJzogJyYnLFxuICAgICAgICAgICAgJ25ld3NTY3JvbGxNYXJrUmVhZCc6ICcmJyxcbiAgICAgICAgICAgICduZXdzU2Nyb2xsRW5hYmxlZE1hcmtSZWFkJzogJz0nLFxuICAgICAgICB9LFxuICAgICAgICBsaW5rOiBmdW5jdGlvbiAoc2NvcGUsIGVsZW0pIHtcbiAgICAgICAgICAgIHZhciBhbGxvd1Njcm9sbCA9IHRydWU7XG4gICAgICAgICAgICB2YXIgc2Nyb2xsQXJlYSA9IGVsZW07XG5cbiAgICAgICAgICAgIGlmIChzY29wZS5uZXdzU2Nyb2xsKSB7XG4gICAgICAgICAgICAgICAgc2Nyb2xsQXJlYSA9ICQoc2NvcGUubmV3c1Njcm9sbCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBzY3JvbGxIYW5kbGVyID0gZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgIC8vIGFsbG93IG9ubHkgb25lIHNjcm9sbCBldmVudCB0byB0cmlnZ2VyIGV2ZXJ5IDMwMG1zXG4gICAgICAgICAgICAgICAgaWYgKGFsbG93U2Nyb2xsKSB7XG4gICAgICAgICAgICAgICAgICAgIGFsbG93U2Nyb2xsID0gZmFsc2U7XG5cbiAgICAgICAgICAgICAgICAgICAgJHRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dTY3JvbGwgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICB9LCBTQ1JPTExfVElNRU9VVCoxMDAwKTtcblxuICAgICAgICAgICAgICAgICAgICBhdXRvUGFnZShJVEVNX0FVVE9fUEFHRV9TSVpFLCBlbGVtLCBzY29wZSk7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gZG9udCBzdGFjayBtYXJrIHJlYWQgcmVxdWVzdHNcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRpbWVyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAkdGltZW91dC5jYW5jZWwodGltZXIpO1xuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gYWxsb3cgdXNlciB0byB1bmRvIGFjY2lkZW50YWwgc2Nyb2xsXG4gICAgICAgICAgICAgICAgICAgIHRpbWVyID0gJHRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWFya1JlYWQoc2NvcGUubmV3c1Njcm9sbEVuYWJsZWRNYXJrUmVhZCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsZW0sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29wZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aW1lciA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICAgICAgfSwgTUFSS19SRUFEX1RJTUVPVVQqMTAwMCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgc2Nyb2xsQXJlYS5vbignc2Nyb2xsJywgc2Nyb2xsSGFuZGxlcik7XG5cbiAgICAgICAgICAgIC8vIHJlbW92ZSBzY3JvbGwgaGFuZGxlciBpZiBlbGVtZW50IGlzIGRlc3Ryb3llZFxuICAgICAgICAgICAgc2NvcGUuJG9uKCckZGVzdHJveScsIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgICBzY3JvbGxBcmVhLm9mZignc2Nyb2xsJywgc2Nyb2xsSGFuZGxlcik7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAg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GJ5XG4gICAgICAgICAgICAvLyBmb3IgaW5zdGFuY2UgY2xpY2tpbmcgb24gdGhlIHggYnV0dG9uXG4gICAgICAgICAgICBzY29wZS4kb24oJyRkZXN0cm95JywgZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgIGRlc3Ryb3llZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgJHRpbWVvdXQuY2FuY2VsKHRpbWVyKTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAvLyBhbHNvIGRlbGV0ZSB0aGUgZW50cnkgaWYgdW5kbyBpcyBpZ25vcmVkIGFuZCB0aGUgdXJsXG4gICAgICAgICAgICAvLyBpcyBjaGFuZ2VkXG4gICAgICAgICAgICAkcm9vdFNjb3BlLiRvbignJGxvY2F0aW9uQ2hhbmdlU3RhcnQnLCBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgLy8gJGxvY2F0aW9uQ2hhbmdlU3RhcnQgdHJpZ2dlcnMgdHdpY2UgYmVjYXVzZSBvZiB0aGUgdHJhaWxpbmdcbiAgICAgICAgICAgICAgICAvLyBzbGFzaCBvbiB0aGUgbGluayB3aGljaCBpcyBraW5kYSBhIGhhY2sgdG8gcmVsb2FkIHRoZSByb3V0ZVxuICAgICAgICAgICAgICAgIC8vIGlmIHlvdSBjbGljayBvbiB0aGUgbGluayB3aGVuIHRoZSByb3V0ZSBpcyB0aGUgc2FtZVxuICAgICAgICAgICAgICAgICR0aW1lb3V0LmNhbmNlbCh0aW1lcik7XG4gICAgICAgICAgICAgICAgaWYgKCFkZXN0cm95ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgZGVzdHJveWVkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5yZW1vdmUoKTtcbiAgICAgICAgICAgICAgICAgICAgc2NvcGUubmV3c1RpbWVvdXQoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH07XG59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ICAgICAgICAgICAgICAgICAnKCcgKyB2YWx1ZSArICcpIC0gJyArIG93bkNsb3VkTmFtZTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAkd2luZG93LmRvY3VtZW50LnRpdGxlID0gYXBwTmFtZSArICcgLSAnICsgb3duQ2xvdWROYW1lO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfTtcblxufV0pOyIsIi8qKlxuICogb3duQ2xvdWQgLSBOZXdzXG4gKlxuICogVGhpcyBmaWxlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBBZmZlcm8gR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2ZXJzaW9uIDMgb3JcbiAqIGxhdGVyLiBTZWUgdGhlIENPUFlJTkcgZmlsZS5cbiAqXG4gKiBAYXV0aG9yIEJlcm5oYXJkIFBvc3NlbHQgPGRldkBiZXJuaGFyZC1wb3NzZWx0LmNvbT5cbiAqIEBjb3B5cmlnaHQgQmVybmhhcmQgUG9zc2VsdCAyMDE0XG4gKi9cbmFwcC5kaXJlY3RpdmUoJ25ld3NUb2dnbGVTaG93JywgZnVuY3Rpb24gKCkge1xuICAgICd1c2Ugc3RyaWN0JztcbiAgICByZXR1cm4ge1xuICAgICAgICByZXN0cmljdDogJ0EnLFxuICAgICAgICBzY29wZToge1xuICAgICAgICAgICAgJ25ld3NUb2dnbGVTaG93JzogJ0AnXG4gICAgICAgIH0sXG4gICAgICAgIGxpbms6IGZ1bmN0aW9uIChzY29wZSwgZWxlbSkge1xuICAgICAgICAgICAgZWxlbS5jbGljayhmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgICAgdmFyIHRhcmdldCA9ICQoc2NvcGUubmV3c1RvZ2dsZVNob3cpO1xuICAgICAgICAgICAgICAgIHRhcmdldC50b2dnbGUoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfTtcbn0pO1xuIiwiLyoqXG4gKiBvd25DbG91ZCAtIE5ld3NcbiAqXG4gKiBUaGlzIGZpbGUgaXMgbGljZW5zZWQgdW5kZXIgdGhlIEFmZmVybyBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIHZlcnNpb24gMyBvclxuICogbGF0ZXIuIFNlZSB0aGUgQ09QWUlORyBmaWxlLlxuICpcbiAqIEBhdXRob3IgQmVybmhhcmQgUG9zc2VsdCA8ZGV2QGJlcm5oYXJkLXBvc3NlbHQuY29tPlxuICogQGNvcHlyaWdodCBCZXJuaGFyZCBQb3NzZWx0IDIwMTRcbiAqL1xuYXBwLmRpcmVjdGl2ZSgnbmV3c1RyaWdnZXJDbGljaycsIGZ1bmN0aW9uICgpIHtcbiAgICAndXNlIHN0cmljdCc7XG5cbiAgICByZXR1cm4gZnVuY3Rpb24gKHNjb3BlLCBlbG0sIGF0dHIpIHtcbiAgICAgICAgZWxtLmNsaWNrKGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICQoYXR0ci5uZXdzVHJpZ2dlckNsaWNrKS50cmlnZ2VyKCdjbGljaycpO1xuICAgICAgICB9KTtcbiAgICB9O1xuXG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0= diff --git a/js/controller/NavigationController.js b/js/controller/NavigationController.js index 160f77bac..4f7d549bf 100644 --- a/js/controller/NavigationController.js +++ b/js/controller/NavigationController.js @@ -175,7 +175,8 @@ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, // is closed or has no unread articles existingFolder.getsFeed = true; - FeedResource.create(feed.url, existingFolder.id, undefined) + FeedResource.create(feed.url, existingFolder.id, undefined, + feed.user, feed.password) .then(function (data) { Publisher.publishAll(data); @@ -186,6 +187,8 @@ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, }).finally(function () { existingFolder.getsFeed = undefined; feed.url = ''; + feed.user = ''; + feed.password = ''; self.addingFeed = false; }); @@ -202,6 +205,7 @@ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, self.createFeed(feed); }); } + }; this.createFolder = function (folder) { diff --git a/js/gulpfile.js b/js/gulpfile.js index 44b7776e5..9dece784b 100644 --- a/js/gulpfile.js +++ b/js/gulpfile.js @@ -77,7 +77,7 @@ gulp.task('watch-karma', (done) => { }); gulp.task('phpunit', () => { - gulp.src(phpSources) + return gulp.src(phpSources) .pipe(phpunit('phpunit', { configurationFile: phpunitConfig })); diff --git a/js/service/FeedResource.js b/js/service/FeedResource.js index 00383983e..84a8ef7c2 100644 --- a/js/service/FeedResource.js +++ b/js/service/FeedResource.js @@ -163,7 +163,8 @@ app.factory('FeedResource', function (Resource, $http, BASE_URL, $q) { }; - FeedResource.prototype.create = function (url, folderId, title) { + FeedResource.prototype.create = function (url, folderId, title, user, + password) { url = url.trim(); if (!url.startsWith('http')) { url = 'https://' + url; @@ -191,7 +192,9 @@ app.factory('FeedResource', function (Resource, $http, BASE_URL, $q) { data: { url: url, parentFolderId: folderId || 0, - title: title + title: title, + user: user || null, + password: password || null } }).success(function (data) { deferred.resolve(data); diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js index 904455c5c..d353880c4 100644 --- a/js/tests/unit/controller/NavigationControllerSpec.js +++ b/js/tests/unit/controller/NavigationControllerSpec.js @@ -324,7 +324,7 @@ describe('NavigationController', function () { callback({feeds: [{ id: 3, url: url, - folderId: folderId + folderId: folderId, }]}); return { finally: function (callback) { @@ -361,7 +361,7 @@ describe('NavigationController', function () { expect(ctrl.showNewFolder).toBe(false); expect(FeedResource.create).toHaveBeenCalledWith('test', 3, - undefined); + undefined, undefined, undefined); expect(Publisher.publishAll).toHaveBeenCalledWith({feeds: [{ id: 3, url: 'test', @@ -430,14 +430,16 @@ describe('NavigationController', function () { var feed = { url: 'test', - newFolder: 'john' + newFolder: 'john', + user: 'user', + password: 'password' }; ctrl.createFeed(feed); expect(ctrl.showNewFolder).toBe(false); expect(FeedResource.create).toHaveBeenCalledWith('test', 19, - undefined); + undefined, 'user', 'password'); expect(FolderResource.create).toHaveBeenCalledWith('john'); expect(Publisher.publishAll).toHaveBeenCalledWith({ folders: [{ diff --git a/js/tests/unit/service/FeedResourceSpec.js b/js/tests/unit/service/FeedResourceSpec.js index 95767e633..45e088fce 100644 --- a/js/tests/unit/service/FeedResourceSpec.js +++ b/js/tests/unit/service/FeedResourceSpec.js @@ -157,10 +157,12 @@ describe('FeedResource', function () { http.expectPOST('base/feeds', { parentFolderId: 5, url: 'https://hey', - title: 'abc' + title: 'abc', + user: 'john', + password: 'doe' }).respond(200, {}); - FeedResource.create(' hey ', 5, ' abc'); + FeedResource.create(' hey ', 5, ' abc', 'john', 'doe'); http.flush(); @@ -172,7 +174,9 @@ describe('FeedResource', function () { http.expectPOST('base/feeds', { parentFolderId: 5, url: 'http://hey', - title: 'abc' + title: 'abc', + user: null, + password: null }).respond(200, {}); FeedResource.create('http://hey', 5, 'abc'); @@ -187,7 +191,9 @@ describe('FeedResource', function () { http.expectPOST('base/feeds', { parentFolderId: 5, url: 'https://hey', - title: 'abc' + title: 'abc', + user: null, + password: null }).respond(400, {message: 'noo'}); FeedResource.create('https://hey', 5, 'abc'); @@ -203,6 +209,8 @@ describe('FeedResource', function () { http.expectPOST('base/feeds', { parentFolderId: 0, url: 'https://hey', + user: null, + password: null }).respond(200, {}); FeedResource.create('hey', undefined); diff --git a/service/feedservice.php b/service/feedservice.php index a6ebc27cb..19c0a3b4b 100644 --- a/service/feedservice.php +++ b/service/feedservice.php @@ -89,14 +89,20 @@ class FeedService extends Service { * folder * @param string $userId for which user the feed should be created * @param string $title if given, this is used for the opml feed title + * @param string $basicAuthUser if given, basic auth is set for this feed + * @param string $basicAuthPassword if given, basic auth is set for this + * feed. Ignored if user is null or an empty string * @throws ServiceConflictException if the feed exists already * @throws ServiceNotFoundException if the url points to an invalid feed * @return Feed the newly created feed */ - public function create($feedUrl, $folderId, $userId, $title=null){ + public function create($feedUrl, $folderId, $userId, $title=null, + $basicAuthUser=null, $basicAuthPassword=null){ // first try if the feed exists already try { - list($feed, $items) = $this->feedFetcher->fetch($feedUrl); + list($feed, $items) = $this->feedFetcher->fetch($feedUrl, true, + null, null, false, $basicAuthUser, + $basicAuthPassword); // try again if feed exists depending on the reported link try { @@ -109,6 +115,8 @@ class FeedService extends Service { // insert feed $itemCount = count($items); + $feed->setBasicAuthUser($basicAuthUser); + $feed->setBasicAuthPassword($basicAuthPassword); $feed->setFolderId($folderId); $feed->setUserId($userId); $feed->setArticlesPerUpdate($itemCount); @@ -198,7 +206,9 @@ class FeedService extends Service { false, $existingFeed->getLastModified(), $existingFeed->getEtag(), - $existingFeed->getFullTextEnabled() + $existingFeed->getFullTextEnabled(), + $existingFeed->getBasicAuthUser(), + $existingFeed->getBasicAuthPassword() ); // if there is no feed it means that no update took place diff --git a/templates/part.navigation.addfeed.php b/templates/part.navigation.addfeed.php index 58f3b2e76..663535115 100644 --- a/templates/part.navigation.addfeed.php +++ b/templates/part.navigation.addfeed.php @@ -75,6 +75,26 @@ <?php p($l->t('Folder exists already!')); ?> </p> + <!-- basic auth --> + <button type="button" class="add-feed-advanced" ng-click="Navigation.showAddFeedAdvanced=!Navigation.showAddFeedAdvanced"> + <?php p($l->t('Advanced settings')); ?> + </button> + <div ng-if="Navigation.showAddFeedAdvanced" class="add-feed-advanced-area"> + <h2><?php p($l->t('Credentials')); ?></h2> + <p class="warning"><?php p($l->t('HTTP Basic Auth credentials must be stored unencrypted! Everyone with access to the server or database will be able to access them!')); ?></p> + <input type="text" + ng-model="Navigation.feed.user" + placeholder="<?php p($l->t('Username')); ?>" + name="user" + autofocus> + + <input type="password" + ng-model="Navigation.feed.password" + placeholder="<?php p($l->t('Password')); ?>" + name="password"> + </div> + + <!-- submit --> <input type="submit" value="<?php p($l->t('Subscribe')); ?>" class="primary" diff --git a/tests/unit/db/FeedTest.php b/tests/unit/db/FeedTest.php index 7a8c597ea..d5f101c09 100644 --- a/tests/unit/db/FeedTest.php +++ b/tests/unit/db/FeedTest.php @@ -36,6 +36,8 @@ class FeedTest extends \PHPUnit_Framework_TestCase { $feed->setUpdateMode(1); $feed->setUpdateErrorCount(2); $feed->setLastUpdateError('hi'); + $feed->setBasicAuthUser('user'); + $feed->setBasicAuthPassword('password'); return $feed; } @@ -81,7 +83,9 @@ class FeedTest extends \PHPUnit_Framework_TestCase { 'pinned' => true, 'updateMode' => 1, 'updateErrorCount' => 2, - 'lastUpdateError' => 'hi' + 'lastUpdateError' => 'hi', + 'basicAuthUser' => 'user', + 'basicAuthPassword' => 'password' ], $feed->jsonSerialize()); } diff --git a/tests/unit/service/FeedServiceTest.php b/tests/unit/service/FeedServiceTest.php index 181642a45..a6cee6159 100644 --- a/tests/unit/service/FeedServiceTest.php +++ b/tests/unit/service/FeedServiceTest.php @@ -120,6 +120,8 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase { $createdFeed->setUrlHash('hsssi'); $createdFeed->setLink($url); $createdFeed->setTitle('hehoy'); + $createdFeed->setBasicAuthUser('user'); + $createdFeed->setBasicAuthPassword('pass'); $item1 = new Item(); $item1->setGuidHash('hi'); $item2 = new Item(); @@ -173,11 +175,14 @@ class FeedServiceTest extends \PHPUnit_Framework_TestCase { ->method('insert') ->with($this->equalTo($return[1][0])); - $feed = $this->feedService->create($url, $folderId, $this->user); + $feed = $this->feedService->create($url, $folderId, $this->user, null, + 'user', 'pass'); $this->assertEquals($feed->getFolderId(), $folderId); $this->assertEquals($feed->getUrl(), $url); $this->assertEquals($feed->getArticlesPerUpdate(), 2); + $this->assertEquals($feed->getBasicAuthUser(), 'user'); + $this->assertEquals($feed->getBasicAuthPassword(), 'pass'); } |