text: define(["jquery","core/templates","core/notification","core/paged_content","core/paged_content_events","core/pubsub","core/ajax"],function(a,b,c,d,e,f,g){var h={PAGED_CONTENT:"core/paged_content"},i={ITEMS_PER_PAGE_SINGLE:25,ITEMS_PER_PAGE_ARRAY:[25,50,100,0],MAX_PAGES:3},j=function(){return{pagingbar:!1,pagingdropdown:!1,skipjs:!0,ignorecontrolwhileloading:!0,controlplacementbottom:!1}},k=function(){return{showitemsperpageselector:!1,itemsperpage:35,previous:!0,next:!0,activepagenumber:1,hidecontrolonsinglepage:!0,pages:[]}},l=function(a,b){var c=1;if(a>0){var d=a%b;d?(a-=d,c=a/b+1):c=a/b}return c},m=function(b,c){null===c&&(c=i.ITEMS_PER_PAGE_SINGLE),a.isArray(c)&&(c=c[0]);var d=k();d.itemsperpage=c;for(var e=l(b,c),f=1;f<=e;f++){var g={number:f,page:""+f};1===f&&(g.active=!0),d.pages.push(g)}return d},n=function(b){if(a.isArray(b)){var c=b.map(function(a){return"number"==typeof a?{value:a,active:!1}:a}),d=c.filter(function(a){return a.active});return d.length||(c[0].active=!0),c}return b},o=function(b){null===b&&(b=i.ITEMS_PER_PAGE_ARRAY);var c=k();return c.itemsperpage=n(b),c.showitemsperpageselector=a.isArray(b),c},p=function(a,b){return a?m(a,b):o(b)},q=function(b,c){if(null===b&&(b=i.ITEMS_PER_PAGE_SINGLE),a.isArray(b))return{options:b};var d={options:[]},e=0,f=0,g=i.MAX_PAGES;c.hasOwnProperty("maxPages")&&(g=c.maxPages);for(var h=1;h<=g;h++){var j=0;h<=2?(j=b,f=b):(f=2*f,j=f),e+=j;var k={itemcount:j,content:e};1===h&&(k.active=!0),d.options.push(k)}return d},r=function(a,b,c){var d=j();return c.hasOwnProperty("ignoreControlWhileLoading")&&(d.ignorecontrolwhileloading=c.ignoreControlWhileLoading),c.hasOwnProperty("controlPlacementBottom")&&(d.controlplacementbottom=c.controlPlacementBottom),c.hasOwnProperty("hideControlOnSinglePage")&&(d.hidecontrolonsinglepage=c.hideControlOnSinglePage),c.hasOwnProperty("ariaLabels")&&(d.arialabels=c.ariaLabels),c.hasOwnProperty("dropdown")&&c.dropdown?d.pagingdropdown=q(b,c):d.pagingbar=p(a,b),d},s=function(a,b){return u(null,null,a,b)},t=function(a,b,c){return u(null,a,b,c)},u=function(e,f,g,i){i=i||{};var j=a.Deferred(),k=r(e,f,i);return b.render(h.PAGED_CONTENT,k).then(function(b,c){b=a(b);var e=b.attr("id");i.hasOwnProperty("eventNamespace")&&(e=i.eventNamespace);var f=b;d.init(f,g,e),y(e,i),j.resolve(b,c)}).fail(function(a){j.reject(a)}).fail(c.exception),j.promise()},v=function(a,b,c,d){"undefined"==typeof d&&(d={});var e=a.length;return u(e,b,function(b){var d=[];return b.forEach(function(b){var c=b.offset,f=b.limit?c+b.limit:e,g=a.slice(c,f);d.push(g)}),c(d)},d)},w=function(a,b){f.publish(a+e.ALL_ITEMS_LOADED,b)},x=function(a){var b=function(b){var c={preferences:[{type:a,value:b}]},d={methodname:"core_user_update_user_preferences",args:c};g.call([d])};return b},y=function(a,b){b.hasOwnProperty("persistentLimitKey")&&f.subscribe(a+e.SET_ITEMS_PER_PAGE_LIMIT,x(b.persistentLimitKey))};return{create:s,createWithLimit:t,createWithTotalAndLimit:u,createFromStaticList:v,createFromAjax:u,resetLastPageNumber:w}});