From 9d934de70c29469948cef7db83162e26ecc8aff4 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 11 Jun 2024 17:03:53 +0200 Subject: [PATCH 1/2] Announcements: allow user to close feature announcements Add a small "X" next in the right top corner of the announcement to let the users to close the announcement. It uses a cookie to avoid showing it next time they load the page. Related * #333 * #103 --- .../static/readthedocsext/theme/js/site.js | 2 +- .../partials/dashboard/traffic-analytics.html | 31 ++++++++++--------- src/js/project/index.js | 23 ++++++++++++++ 3 files changed, 41 insertions(+), 15 deletions(-) diff --git a/readthedocsext/theme/static/readthedocsext/theme/js/site.js b/readthedocsext/theme/static/readthedocsext/theme/js/site.js index 890d14e8..6c87a2c0 100644 --- a/readthedocsext/theme/static/readthedocsext/theme/js/site.js +++ b/readthedocsext/theme/static/readthedocsext/theme/js/site.js @@ -1 +1 @@ -(()=>{"use strict";var e,t,n,r,o,i={286:()=>{},8488:e=>{if("undefined"==typeof moment){var t=new Error("Cannot find module 'moment'");throw t.code="MODULE_NOT_FOUND",t}e.exports=moment},8234:(e,t,n)=>{var r=n(9755),o=n(8527),i=n(2152);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"body";console.debug("Attaching application to selector:",e),o.applyBindings(this,r(e)[0])}},{key:"show_modal",value:function(e){return function(t,n){var o="[data-modal-id="+e+"]";console.debug("Showing modal:",o),0===r(o).modal("show").length&&console.debug("Modal not found:",o)}}},{key:"post_child_form",value:function(e,t){var n=t.currentTarget.querySelector(":scope > form");return n&&n.submit(),!1}}],n&&u(t.prototype,n),i&&u(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();globalThis.jQuery=r;var l=n(2876),f=(n(4238),n(7239),n(8105),n(7030),n(83),n(4567),n(1714),n(5082),n(8225),n(4696),n(5812),n(2208),n(3441),n(4671),n(9610),n(4115),n(2445),n(6426),n(3150),n(8329),n(1307),n(8182),n(9755));function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?o-1:0),a=1;a1&&void 0!==arguments[1]&&arguments[1])&&(t.trackLocalhost=!0);var n=(0,l.Z)(t).trackEvent;return(0,(0,l.Z)(t).trackPageview)(),this.each((function(e,t){function r(e){var r=t.getAttribute("data-analytics").split(/,(.+)/),o=null!=t.tagName&&"a"==t.tagName.toLowerCase(),i="auxclick"==e.type&&2==e.which,a="click"==e.type,u=o&&a&&!t.target&&!(e.ctrlKey||e.metaKey||e.shiftKey);if(i||a){var c,s=function(){u&&t.href&&"#"!=t.href&&(console.debug("Plausible: resuming redirect to",t.href),location.href=t.href)},l=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(r);try{var f=function(){var e=c.value;n(e,{callback:function(){console.debug("Plausible: tracked event",e),s()}}),setTimeout((function(){console.debug("Plausible: didn't receive response, continuing anyways"),s()}),150)};for(l.s();!(c=l.n()).done;)f()}catch(e){l.e(e)}finally{l.f()}}u&&e.preventDefault()}t.addEventListener("click",r),t.addEventListener("auxclick",r)}))}function k(e){return this.each((function(t,n){f(n).find(".item").tab(e)}))}function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function x(e,t,n){return x=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&E(o,n.prototype),o},x.apply(null,arguments)}function E(e,t){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},E(e,t)}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&n.is_expanded(!0)})),this.output=o.observable(),this.output_lines=o.computed((function(){return n.output().split(/\n/).map((function(e,t){return new Z({command:n,output:e,line_number:t+1})}))}),null,{deferEvaluation:!0}),this.output(t.output)}return K(e,[{key:"color_output",value:function(e){return Promise.all([n.e("ansi_up").then(n.t.bind(n,4431,19)).then((function(e){return e.default})),n.e("sanitize-html").then(n.t.bind(n,1036,19)).then((function(e){return e.default}))]).then((function(t){var n,r,o=z(t,2);n=o[0],r=o[1];var i=new n;return i.use_classes=!0,e=r(e=i.ansi_to_html(e),{allowedTags:["span"],allowedAttributes:{span:["class"]}})}))}},{key:"toggle_expanded",value:function(){return this.is_expanded(!this.is_expanded()),!1}}]),e}(),Y=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0;X(this,e),this.id=n.id,this.url_api_build=i,this.url_api_notifications=a,this.success=o.observable(n.success),this.error=o.observable(n.error),this.notifications=o.observableArray(),this.has_notifications=o.computed((function(){return t.notifications().length>0})),this.state=o.observable(n.state),this.state_display=o.observable(n.state_display),this.is_finished=o.observable(!1),this.is_loading=o.observable(!0),this.can_cancel=o.observable(!1),this.can_retry=o.observable(!1),this.can_view_docs=o.observable(!1),this.state.subscribe((function(e){t.update_state(e)})),this.progress_config=o.computed((function(){var e=t.state(),n=["triggered","queued","cloning","installing","building","uploading","finished"];if(o.computedContext.isInitial())return{autoSuccess:!1,value:n.indexOf(e),total:n.length-1,label:t.state_display()};if(t.is_finished()){var r="cancelled"===e,i=t.error()||!1===t.success();return r?function(e){e("set warning","Build cancelled")}:i?function(e){e("set error","Build failed")}:function(e){e("set success","Build succeeded")}}return function(r){r("set progress",n.indexOf(e)),r("set label",t.state_display())}})).extend({deferred:!0}),this.date=o.observable(n.date),this.length=o.observable(n.length),this.date_display=o.observable(),this.date_display_since=o.observable(),this.length_display=o.observable(),U.extend(D),U.extend(H),U.extend(q),this.date.subscribe((function(e){var n=U(e);t.date_display(n.format("llll")),t.date_display_since(n.fromNow())})),this.length.subscribe((function(e){t.length_display(U.duration(e,"seconds").humanize())})),this.config=o.observable(),this.builder=o.observable(n.builder),this.commands=o.observableArray(n.commands),this.commit=o.observable(n.commit),this.commit_short=o.computed((function(){var e=t.commit();if(e)return e.substring(0,8)})),this.docs_url=o.observable(n.docs_url),this.commit_url=o.observable(n.commit_url),this.legacy_output=o.observable(!1),this.selected_hash=o.observable(r(location).attr("hash")),this.selected_hash.subscribe((function(e){r(location).attr("hash",e)})),this.selected_line=o.observable(),this.selected_line.subscribe((function(e){e&&e.is_selected(!1)}),this,"beforeChange"),this.selected_line.subscribe((function(e){e.command.is_expanded(!0),e.is_selected(!0),t.selected_hash(e.anchor_id())})),this.show_debug=o.observable(!1),this.is_polling=o.observable(!0),this.is_polling.subscribe((function(e){e||t.set_selected_line_from_hash(t.selected_hash())})),this.url_api_build&&this.poll_api_build(),this.url_api_notifications&&this.poll_api_notifications()}return K(e,[{key:"poll_api_build",value:function(){var e=this;r.getJSON(this.url_api_build).then((function(t){e.date(t.date),e.success(t.success),e.error(t.error),e.length(t.length),e.commit(t.commit),e.docs_url(t.docs_url),e.commit_url(t.commit_url),e.builder(t.builder),e.config(t.config),e.state(t.state),e.state_display(t.state_display),e.add_command({id:0,command:"readthedocs-build --show-config",output:JSON.stringify(t.config,null," "),exit_code:0,run_time:0,is_debug:!0});var n,r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=J(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t.commands);try{for(r.s();!(n=r.n()).done;){var o=n.value;e.add_command(o)}}catch(e){r.e(e)}finally{r.f()}e.is_loading(!1)})).then((function(){e.is_finished()?e.is_polling(!1):setTimeout((function(){e.poll_api_build(),e.poll_api_notifications()}),2e3)}))}},{key:"poll_api_notifications",value:function(){var e=this;r.getJSON(this.url_api_notifications,{state__in:"read,unread"}).then((function(t){t.results&&e.notifications(t.results)}))}},{key:"add_command",value:function(e){o.utils.arrayFirst(this.commands(),(function(t){return t.id()===e.id}))||this.commands.push(new Q(e))}},{key:"set_selected_line",value:function(e){this.selected_line(e);var t=document.querySelector("[data-selected=true]");return t&&(t.scrollIntoView?t.scrollIntoView({behavior:"auto",block:"center",inline:"center"}):r(t).focus()),!1}},{key:"set_selected_line_from_hash",value:function(e){if(e){var t=e.match(/^#(\d+)--(\d+)$/);if(!t)return;var n=o.utils.arrayFirst(this.commands(),(function(e){return e.id()==t[1]}));if(n){var r=o.utils.arrayFirst(n.output_lines(),(function(e){return e.line_number()==t[2]}));r&&this.set_selected_line(r)}}}},{key:"show_legacy_output",value:function(){this.legacy_output(!0)}},{key:"toggle_debug",value:function(){var e=this.show_debug();this.show_debug(!e)}},{key:"update_state",value:function(e){["finished","cancelled"].includes(e)?(this.is_finished(!0),this.can_cancel(!1),this.can_retry(!0),this.success()&&this.can_view_docs(!0)):this.can_cancel(!0)}}]),e}();function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function ee(e,t){for(var n=0;n=oe[o];t.device[o](i)}}));var n=r(window),i=function(){t.viewport_width(n.width())};n.on("resize",i),i()})),ae=function(){function e(t){re(this,e),this.id=t.id,this.url=t.url,this.loaded=o.observable(!1),this.loading=o.observable(!1),this.promise=null,this.data=o.observable()}return te(e,[{key:"fetch",value:function(){var e=this;if(this.promise)return this.promise;this.promise=new Promise((function(t,n){if(e.loaded())return t(e.data());e.loading(!0),r.getJSON(e.url).then((function(n){return e.data(n),e.loaded(!0),e.loading(!1),t(n)}))}))}}]),e}(),ue=te((function e(){var t=this;re(this,e),this.config=o.observable(),this.search_project_config=o.observable(),this.config.subscribe((function(e){if(void 0!==e){var n=new URL(e.api_projects_list_url,window.location.origin);n.search="?name={query}",t.search_project_config({type:"category",apiSettings:{url:n.href,onResponse:function(e){return{results:{"category-projects":{name:"Projects",results:e.results.map((function(e,t){var n=e.slug;e.subproject_of?n="Subproject of "+e.subproject_of.name:e.translation_of&&(n=e.language.name+" translation of "+e.translation_of.name);var r=new URL(e.urls.home),o=new URL(window.location.href);return r.hostname!=o.hostname&&(r.hostname=o.hostname),{title:e.name,description:n,url:r.toString()}}))}}}}},minCharacters:2})}}))}));function ce(e){return ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ce(e)}function se(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return le(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0])||arguments[0];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.is_collapsed=o.observable(n),this.dropdown_class=o.computed((function(){return t.is_collapsed()?"fa-caret-down":"fa-caret-up"}))}var t,n,r;return t=e,n=[{key:"toggle_collapsed",value:function(){var e=this.is_collapsed();this.is_collapsed(!e)}}],n&&Te(t.prototype,n),r&&Te(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ce(e){return Ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ce(e)}function Ae(e,t){for(var n=0;n\n ','\n
\n \n ',"\n
\n

","

\n \n "])),(0,Ue.$)(t),(0,Ve.g)(this.notification.dismissable,(function(){return(0,Le.dy)(We||(We=Qe(['\n 0)setTimeout(o,2e3);else{var r=e.statusText;e.responseJSON&&(r=e.responseJSON.detail),t.reject({message:r})}}))}),2e3),t})(e).then((function(){t.resolve()})).fail((function(e){t.reject(e)}))},error:function(e){var n=e.responseJSON.detail||e.statusText;t.reject({message:n})}}),t}function Ct(e){return Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ct(e)}function At(e,t){return At=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},At(e,t)}function Rt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Nt(e);if(t){var o=Nt(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Ct(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Nt(e){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Nt(e)}function It(e,t){for(var n=0;n0}))})),$t=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&At(e,t)}(n,e);var t=Rt(n);function n(){var e;return Vt(this,n),(e=t.call(this)).config=o.observable(),e.search_config=o.observable(),e.selected=o.observable(),e.is_loading=o.observable(!1),e.is_syncing=o.observable(!1),e.is_selected=o.computed((function(){return void 0!==e.selected()})),e.allow_private_repos=o.observable(!1),e.error=o.observable(),e.config.subscribe((function(t){void 0!==t&&(e.allow_private_repos(t.allow_private_repos),e.init_search())})),e}return Lt(n,[{key:"sync_remote_repos",value:function(){var e=this,t=this.config(),n={url:t.urls.api_sync_remote_repositories,token:t.csrf_token};return this.is_syncing(!0),this.is_loading(!0),Et(n).fail((function(t){console.error("Error syncing remote repositories:",t.message),e.error(t.message)})).always((function(){e.is_syncing(!1),e.is_loading(!1)}))}},{key:"init_search",value:function(){var e=this,t=this.config().urls.remoterepository_list+"?expand=projects&full_name={query}";this.search_config({type:"knockout",templates:{knockout:function(e){var t=r("
");o.applyBindingsToNode(t[0],{template:{name:"remote-repo-results",data:{remote_repos:e.results.map((function(e){return new qt(e)}))}}});var n=t.html();return t.remove(),n}},apiSettings:{url:t},selector:{prompt:".ui.text",title:".title .text"},fullTextSearch:!0,onSelect:function(t,n){e.selected(new qt(t))}})}},{key:"is_repository_supported",value:function(e){return!e.is_private()||this.allow_private_repos()}}]),n}(ie);function zt(e){return zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zt(e)}function Jt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Mt(e,t){for(var n=0;n\n ',"\n
\n "])),(0,pt.U)(e.results,(function(e){return(0,Le.dy)(Dt||(Dt=Jt(['\n \n
\n
\n
\n ','\n \n ','\n
\n
\n ',"\n
\n
\n
\n "])),e.verbose_name,(0,Ue.$)({"fa-code-branch":"branch"===e.type,"fa-tag":"tag"===e.type}),(0,Ve.g)(e.active,(function(){return(0,Le.dy)(Ht||(Ht=Jt(['\n \n \n Active\n \n '])))})),e.identifier)})));(0,Le.sY)(n,t);var r=t.innerHTML;return t.remove(),r}}}}}]),e}();Yt(tn,"view_name","ProjectVersionCreateView"),V.add_view(tn);var nn=function(e){Wt(n,e);var t=Zt(n);function n(e){var r;return Kt(this,n),(r=t.call(this,e)).url_pdf=o.observable(),r.url_epub=o.observable(),r.url_html=o.observable(),r.url_docs=o.observable(),r.is_built=o.observable(!0),r.data.subscribe((function(e){r.url_pdf(e.downloads.pdf),r.url_epub(e.downloads.epub),r.url_html(e.downloads.html),r.url_docs(e.urls.documentation),r.is_built(e.built)})),r}return Ft(n,[{key:"trigger_build",value:function(e,t){return function(n,o){r.ajax({type:"POST",url:e,data:{csrfmiddlewaretoken:t}}).then((function(e){e.build.urls.build?window.location.href=e.build.urls.build:console.debug("Redirect to new build failed")})).catch((function(e){console.error(e)}))}}}]),n}(ae);function rn(e){return rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rn(e)}function on(e,t){for(var n=0;n select").dropdown({placeholder:""}),r("[data-content]:not([data-semanticui-popup])").popup({position:"top center",delay:{show:500},variation:"small"}),r(".ui.menu > .item[data-tab]").tab(),new i("[data-clipboard-text], [data-clipboard-target]"),r("[data-clipboard-text], [data-clipboard-target]").popup({on:"click",hoverable:!1,content:"Copied!"}),r("[data-analytics]").plausible(this.config.production_domain,this.config.debug)}}])&&on(t.prototype,a),u&&on(t,u),Object.defineProperty(t,"prototype",{writable:!1}),e}();r(document).ready((function(){(new un).run()}))}},a={};function u(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return i[e].call(n.exports,n,n.exports,u),n.exports}u.m=i,e=[],u.O=(t,n,r,o)=>{if(!n){var i=1/0;for(l=0;l=o)&&Object.keys(u.O).every((e=>u.O[e](n[c])))?n.splice(c--,1):(a=!1,o0&&e[l-1][2]>o;l--)e[l]=e[l-1];e[l]=[n,r,o]},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,u.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);u.r(o);var i={};t=t||[null,n({}),n([]),n(n)];for(var a=2&r&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,u.d(o,i),o},u.d=(e,t)=>{for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce(((t,n)=>(u.f[n](e,t),t)),[])),u.u=e=>"js/vendors~"+e+".js?"+{chartjs:"88d308352093cb9caa38",ansi_up:"d27561856946166026c2","sanitize-html":"fe70b4790c12dedf5bc9"}[e],u.miniCssF=e=>{},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o="readthedocsext-theme:",u.l=(e,t,n,i)=>{if(r[e])r[e].push(t);else{var a,c;if(void 0!==n)for(var s=document.getElementsByTagName("script"),l=0;l{a.onerror=a.onload=null,clearTimeout(b);var o=r[e];if(delete r[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(n))),t)return t(n)},b=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),c&&document.head.appendChild(a)}},u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.p="./",(()=>{var e={site:0};u.f.j=(t,n)=>{var r=u.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise(((n,o)=>r=e[t]=[n,o]));n.push(r[2]=o);var i=u.p+u.u(t),a=new Error;u.l(i,(n=>{if(u.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,r[1](a)}}),"chunk-"+t,t)}},u.O.j=t=>0===e[t];var t=(t,n)=>{var r,o,[i,a,c]=n,s=0;if(i.some((t=>0!==e[t]))){for(r in a)u.o(a,r)&&(u.m[r]=a[r]);if(c)var l=c(u)}for(t&&t(n);su(286)));var c=u.O(void 0,["vendor"],(()=>u(8234)));c=u.O(c)})(); \ No newline at end of file +(()=>{"use strict";var e,t,n,r,o,i={286:()=>{},8488:e=>{if("undefined"==typeof moment){var t=new Error("Cannot find module 'moment'");throw t.code="MODULE_NOT_FOUND",t}e.exports=moment},8234:(e,t,n)=>{var r=n(9755),o=n(8527),i=n(2152);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function u(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"body";console.debug("Attaching application to selector:",e),o.applyBindings(this,r(e)[0])}},{key:"show_modal",value:function(e){return function(t,n){var o="[data-modal-id="+e+"]";console.debug("Showing modal:",o),0===r(o).modal("show").length&&console.debug("Modal not found:",o)}}},{key:"post_child_form",value:function(e,t){var n=t.currentTarget.querySelector(":scope > form");return n&&n.submit(),!1}}],n&&u(t.prototype,n),i&&u(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();globalThis.jQuery=r;var l=n(2876),f=(n(4238),n(7239),n(8105),n(7030),n(83),n(4567),n(1714),n(5082),n(8225),n(4696),n(5812),n(2208),n(3441),n(4671),n(9610),n(4115),n(2445),n(6426),n(3150),n(8329),n(1307),n(8182),n(9755));function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?o-1:0),a=1;a1&&void 0!==arguments[1]&&arguments[1])&&(t.trackLocalhost=!0);var n=(0,l.Z)(t).trackEvent;return(0,(0,l.Z)(t).trackPageview)(),this.each((function(e,t){function r(e){var r=t.getAttribute("data-analytics").split(/,(.+)/),o=null!=t.tagName&&"a"==t.tagName.toLowerCase(),i="auxclick"==e.type&&2==e.which,a="click"==e.type,u=o&&a&&!t.target&&!(e.ctrlKey||e.metaKey||e.shiftKey);if(i||a){var c,s=function(){u&&t.href&&"#"!=t.href&&(console.debug("Plausible: resuming redirect to",t.href),location.href=t.href)},l=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(r);try{var f=function(){var e=c.value;n(e,{callback:function(){console.debug("Plausible: tracked event",e),s()}}),setTimeout((function(){console.debug("Plausible: didn't receive response, continuing anyways"),s()}),150)};for(l.s();!(c=l.n()).done;)f()}catch(e){l.e(e)}finally{l.f()}}u&&e.preventDefault()}t.addEventListener("click",r),t.addEventListener("auxclick",r)}))}function k(e){return this.each((function(t,n){f(n).find(".item").tab(e)}))}function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function x(e,t,n){return x=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&E(o,n.prototype),o},x.apply(null,arguments)}function E(e,t){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},E(e,t)}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&n.is_expanded(!0)})),this.output=o.observable(),this.output_lines=o.computed((function(){return n.output().split(/\n/).map((function(e,t){return new Z({command:n,output:e,line_number:t+1})}))}),null,{deferEvaluation:!0}),this.output(t.output)}return K(e,[{key:"color_output",value:function(e){return Promise.all([n.e("ansi_up").then(n.t.bind(n,4431,19)).then((function(e){return e.default})),n.e("sanitize-html").then(n.t.bind(n,1036,19)).then((function(e){return e.default}))]).then((function(t){var n,r,o=z(t,2);n=o[0],r=o[1];var i=new n;return i.use_classes=!0,e=r(e=i.ansi_to_html(e),{allowedTags:["span"],allowedAttributes:{span:["class"]}})}))}},{key:"toggle_expanded",value:function(){return this.is_expanded(!this.is_expanded()),!1}}]),e}(),Y=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0;X(this,e),this.id=n.id,this.url_api_build=i,this.url_api_notifications=a,this.success=o.observable(n.success),this.error=o.observable(n.error),this.notifications=o.observableArray(),this.has_notifications=o.computed((function(){return t.notifications().length>0})),this.state=o.observable(n.state),this.state_display=o.observable(n.state_display),this.is_finished=o.observable(!1),this.is_loading=o.observable(!0),this.can_cancel=o.observable(!1),this.can_retry=o.observable(!1),this.can_view_docs=o.observable(!1),this.state.subscribe((function(e){t.update_state(e)})),this.progress_config=o.computed((function(){var e=t.state(),n=["triggered","queued","cloning","installing","building","uploading","finished"];if(o.computedContext.isInitial())return{autoSuccess:!1,value:n.indexOf(e),total:n.length-1,label:t.state_display()};if(t.is_finished()){var r="cancelled"===e,i=t.error()||!1===t.success();return r?function(e){e("set warning","Build cancelled")}:i?function(e){e("set error","Build failed")}:function(e){e("set success","Build succeeded")}}return function(r){r("set progress",n.indexOf(e)),r("set label",t.state_display())}})).extend({deferred:!0}),this.date=o.observable(n.date),this.length=o.observable(n.length),this.date_display=o.observable(),this.date_display_since=o.observable(),this.length_display=o.observable(),U.extend(D),U.extend(H),U.extend(q),this.date.subscribe((function(e){var n=U(e);t.date_display(n.format("llll")),t.date_display_since(n.fromNow())})),this.length.subscribe((function(e){t.length_display(U.duration(e,"seconds").humanize())})),this.config=o.observable(),this.builder=o.observable(n.builder),this.commands=o.observableArray(n.commands),this.commit=o.observable(n.commit),this.commit_short=o.computed((function(){var e=t.commit();if(e)return e.substring(0,8)})),this.docs_url=o.observable(n.docs_url),this.commit_url=o.observable(n.commit_url),this.legacy_output=o.observable(!1),this.selected_hash=o.observable(r(location).attr("hash")),this.selected_hash.subscribe((function(e){r(location).attr("hash",e)})),this.selected_line=o.observable(),this.selected_line.subscribe((function(e){e&&e.is_selected(!1)}),this,"beforeChange"),this.selected_line.subscribe((function(e){e.command.is_expanded(!0),e.is_selected(!0),t.selected_hash(e.anchor_id())})),this.show_debug=o.observable(!1),this.is_polling=o.observable(!0),this.is_polling.subscribe((function(e){e||t.set_selected_line_from_hash(t.selected_hash())})),this.url_api_build&&this.poll_api_build(),this.url_api_notifications&&this.poll_api_notifications()}return K(e,[{key:"poll_api_build",value:function(){var e=this;r.getJSON(this.url_api_build).then((function(t){e.date(t.date),e.success(t.success),e.error(t.error),e.length(t.length),e.commit(t.commit),e.docs_url(t.docs_url),e.commit_url(t.commit_url),e.builder(t.builder),e.config(t.config),e.state(t.state),e.state_display(t.state_display),e.add_command({id:0,command:"readthedocs-build --show-config",output:JSON.stringify(t.config,null," "),exit_code:0,run_time:0,is_debug:!0});var n,r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=J(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(t.commands);try{for(r.s();!(n=r.n()).done;){var o=n.value;e.add_command(o)}}catch(e){r.e(e)}finally{r.f()}e.is_loading(!1)})).then((function(){e.is_finished()?e.is_polling(!1):setTimeout((function(){e.poll_api_build(),e.poll_api_notifications()}),2e3)}))}},{key:"poll_api_notifications",value:function(){var e=this;r.getJSON(this.url_api_notifications,{state__in:"read,unread"}).then((function(t){t.results&&e.notifications(t.results)}))}},{key:"add_command",value:function(e){o.utils.arrayFirst(this.commands(),(function(t){return t.id()===e.id}))||this.commands.push(new Q(e))}},{key:"set_selected_line",value:function(e){this.selected_line(e);var t=document.querySelector("[data-selected=true]");return t&&(t.scrollIntoView?t.scrollIntoView({behavior:"auto",block:"center",inline:"center"}):r(t).focus()),!1}},{key:"set_selected_line_from_hash",value:function(e){if(e){var t=e.match(/^#(\d+)--(\d+)$/);if(!t)return;var n=o.utils.arrayFirst(this.commands(),(function(e){return e.id()==t[1]}));if(n){var r=o.utils.arrayFirst(n.output_lines(),(function(e){return e.line_number()==t[2]}));r&&this.set_selected_line(r)}}}},{key:"show_legacy_output",value:function(){this.legacy_output(!0)}},{key:"toggle_debug",value:function(){var e=this.show_debug();this.show_debug(!e)}},{key:"update_state",value:function(e){["finished","cancelled"].includes(e)?(this.is_finished(!0),this.can_cancel(!1),this.can_retry(!0),this.success()&&this.can_view_docs(!0)):this.can_cancel(!0)}}]),e}();function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function ee(e,t){for(var n=0;n=oe[o];t.device[o](i)}}));var n=r(window),i=function(){t.viewport_width(n.width())};n.on("resize",i),i()})),ae=function(){function e(t){re(this,e),this.id=t.id,this.url=t.url,this.loaded=o.observable(!1),this.loading=o.observable(!1),this.promise=null,this.data=o.observable()}return te(e,[{key:"fetch",value:function(){var e=this;if(this.promise)return this.promise;this.promise=new Promise((function(t,n){if(e.loaded())return t(e.data());e.loading(!0),r.getJSON(e.url).then((function(n){return e.data(n),e.loaded(!0),e.loading(!1),t(n)}))}))}}]),e}(),ue=te((function e(){var t=this;re(this,e),this.config=o.observable(),this.search_project_config=o.observable(),this.config.subscribe((function(e){if(void 0!==e){var n=new URL(e.api_projects_list_url,window.location.origin);n.search="?name={query}",t.search_project_config({type:"category",apiSettings:{url:n.href,onResponse:function(e){return{results:{"category-projects":{name:"Projects",results:e.results.map((function(e,t){var n=e.slug;e.subproject_of?n="Subproject of "+e.subproject_of.name:e.translation_of&&(n=e.language.name+" translation of "+e.translation_of.name);var r=new URL(e.urls.home),o=new URL(window.location.href);return r.hostname!=o.hostname&&(r.hostname=o.hostname),{title:e.name,description:n,url:r.toString()}}))}}}}},minCharacters:2})}}))}));function ce(e){return ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ce(e)}function se(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return le(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0])||arguments[0];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.is_collapsed=o.observable(n),this.dropdown_class=o.computed((function(){return t.is_collapsed()?"fa-caret-down":"fa-caret-up"}))}var t,n,r;return t=e,n=[{key:"toggle_collapsed",value:function(){var e=this.is_collapsed();this.is_collapsed(!e)}}],n&&Te(t.prototype,n),r&&Te(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function Ce(e){return Ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ce(e)}function Ae(e,t){for(var n=0;n\n ','\n
\n \n ',"\n
\n

","

\n \n "])),(0,Ue.$)(t),(0,Ve.g)(this.notification.dismissable,(function(){return(0,Le.dy)(We||(We=Qe(['\n 0)setTimeout(o,2e3);else{var r=e.statusText;e.responseJSON&&(r=e.responseJSON.detail),t.reject({message:r})}}))}),2e3),t})(e).then((function(){t.resolve()})).fail((function(e){t.reject(e)}))},error:function(e){var n=e.responseJSON.detail||e.statusText;t.reject({message:n})}}),t}function Ct(e){return Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ct(e)}function At(e,t){return At=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},At(e,t)}function Rt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Nt(e);if(t){var o=Nt(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===Ct(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Nt(e){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Nt(e)}function It(e,t){for(var n=0;n0}))})),$t=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&At(e,t)}(n,e);var t=Rt(n);function n(){var e;return Vt(this,n),(e=t.call(this)).config=o.observable(),e.search_config=o.observable(),e.selected=o.observable(),e.is_loading=o.observable(!1),e.is_syncing=o.observable(!1),e.is_selected=o.computed((function(){return void 0!==e.selected()})),e.allow_private_repos=o.observable(!1),e.error=o.observable(),e.config.subscribe((function(t){void 0!==t&&(e.allow_private_repos(t.allow_private_repos),e.init_search())})),e}return Lt(n,[{key:"sync_remote_repos",value:function(){var e=this,t=this.config(),n={url:t.urls.api_sync_remote_repositories,token:t.csrf_token};return this.is_syncing(!0),this.is_loading(!0),Et(n).fail((function(t){console.error("Error syncing remote repositories:",t.message),e.error(t.message)})).always((function(){e.is_syncing(!1),e.is_loading(!1)}))}},{key:"init_search",value:function(){var e=this,t=this.config().urls.remoterepository_list+"?expand=projects&full_name={query}";this.search_config({type:"knockout",templates:{knockout:function(e){var t=r("
");o.applyBindingsToNode(t[0],{template:{name:"remote-repo-results",data:{remote_repos:e.results.map((function(e){return new qt(e)}))}}});var n=t.html();return t.remove(),n}},apiSettings:{url:t},selector:{prompt:".ui.text",title:".title .text"},fullTextSearch:!0,onSelect:function(t,n){e.selected(new qt(t))}})}},{key:"is_repository_supported",value:function(e){return!e.is_private()||this.allow_private_repos()}}]),n}(ie);function zt(e){return zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zt(e)}function Jt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Mt(e,t){for(var n=0;n\n ',"\n
\n "])),(0,pt.U)(e.results,(function(e){return(0,Le.dy)(Dt||(Dt=Jt(['\n \n
\n
\n
\n ','\n \n ','\n
\n
\n ',"\n
\n
\n
\n "])),e.verbose_name,(0,Ue.$)({"fa-code-branch":"branch"===e.type,"fa-tag":"tag"===e.type}),(0,Ve.g)(e.active,(function(){return(0,Le.dy)(Ht||(Ht=Jt(['\n \n \n Active\n \n '])))})),e.identifier)})));(0,Le.sY)(n,t);var r=t.innerHTML;return t.remove(),r}}}}}]),e}();Yt(tn,"view_name","ProjectVersionCreateView"),V.add_view(tn);var nn=function(e){Wt(n,e);var t=Zt(n);function n(e){var r;return Kt(this,n),(r=t.call(this,e)).url_pdf=o.observable(),r.url_epub=o.observable(),r.url_html=o.observable(),r.url_docs=o.observable(),r.is_built=o.observable(!0),r.data.subscribe((function(e){r.url_pdf(e.downloads.pdf),r.url_epub(e.downloads.epub),r.url_html(e.downloads.html),r.url_docs(e.urls.documentation),r.is_built(e.built)})),r}return Ft(n,[{key:"trigger_build",value:function(e,t){return function(n,o){r.ajax({type:"POST",url:e,data:{csrfmiddlewaretoken:t}}).then((function(e){e.build.urls.build?window.location.href=e.build.urls.build:console.debug("Redirect to new build failed")})).catch((function(e){console.error(e)}))}}}]),n}(ae);Yt(nn,"view_name","VersionListItemView"),V.add_view(nn);var rn=function(){function e(t){Kt(this,e),this.cache_key=t,this.prefix_key="announcements",this.storage_key="".concat(this.prefix_key,".").concat(this.cache_key),this.closed=o.observable(),localStorage.getItem(this.storage_key)?this.closed(!0):this.closed(!1)}return Ft(e,[{key:"close_announcement",value:function(){this.closed(!0),localStorage.setItem(this.storage_key,!0)}}]),e}();function on(e){return on="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},on(e)}function an(e,t){for(var n=0;n select").dropdown({placeholder:""}),r("[data-content]:not([data-semanticui-popup])").popup({position:"top center",delay:{show:500},variation:"small"}),r(".ui.menu > .item[data-tab]").tab(),new i("[data-clipboard-text], [data-clipboard-target]"),r("[data-clipboard-text], [data-clipboard-target]").popup({on:"click",hoverable:!1,content:"Copied!"}),r("[data-analytics]").plausible(this.config.production_domain,this.config.debug)}}])&&an(t.prototype,a),u&&an(t,u),Object.defineProperty(t,"prototype",{writable:!1}),e}();r(document).ready((function(){(new cn).run()}))}},a={};function u(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return i[e].call(n.exports,n,n.exports,u),n.exports}u.m=i,e=[],u.O=(t,n,r,o)=>{if(!n){var i=1/0;for(l=0;l=o)&&Object.keys(u.O).every((e=>u.O[e](n[c])))?n.splice(c--,1):(a=!1,o0&&e[l-1][2]>o;l--)e[l]=e[l-1];e[l]=[n,r,o]},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,u.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);u.r(o);var i={};t=t||[null,n({}),n([]),n(n)];for(var a=2&r&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,u.d(o,i),o},u.d=(e,t)=>{for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce(((t,n)=>(u.f[n](e,t),t)),[])),u.u=e=>"js/vendors~"+e+".js?"+{chartjs:"88d308352093cb9caa38",ansi_up:"d27561856946166026c2","sanitize-html":"fe70b4790c12dedf5bc9"}[e],u.miniCssF=e=>{},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o="readthedocsext-theme:",u.l=(e,t,n,i)=>{if(r[e])r[e].push(t);else{var a,c;if(void 0!==n)for(var s=document.getElementsByTagName("script"),l=0;l{a.onerror=a.onload=null,clearTimeout(b);var o=r[e];if(delete r[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(n))),t)return t(n)},b=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),c&&document.head.appendChild(a)}},u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.p="./",(()=>{var e={site:0};u.f.j=(t,n)=>{var r=u.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise(((n,o)=>r=e[t]=[n,o]));n.push(r[2]=o);var i=u.p+u.u(t),a=new Error;u.l(i,(n=>{if(u.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,r[1](a)}}),"chunk-"+t,t)}},u.O.j=t=>0===e[t];var t=(t,n)=>{var r,o,[i,a,c]=n,s=0;if(i.some((t=>0!==e[t]))){for(r in a)u.o(a,r)&&(u.m[r]=a[r]);if(c)var l=c(u)}for(t&&t(n);su(286)));var c=u.O(void 0,["vendor"],(()=>u(8234)));c=u.O(c)})(); \ No newline at end of file diff --git a/readthedocsext/theme/templates/projects/partials/dashboard/traffic-analytics.html b/readthedocsext/theme/templates/projects/partials/dashboard/traffic-analytics.html index 5e128f17..d45894b8 100644 --- a/readthedocsext/theme/templates/projects/partials/dashboard/traffic-analytics.html +++ b/readthedocsext/theme/templates/projects/partials/dashboard/traffic-analytics.html @@ -1,21 +1,24 @@ {% load i18n %} {% with "https://docs.readthedocs.io/page/analytics.html" as url %} -
-
- {% trans "Prioritize your most-read pages" %} -
- {% blocktrans %} - Use traffic analytics to know which documents your users are reading. - This allows you to understand how your documentation is being used and learn more about your audience. - Then you can prioritize your efforts on expanding and updating pages people are reading most. - {% endblocktrans %} +
+
+
+ + {% trans "Prioritize your most-read pages" %} +
+ {% blocktrans %} + Use traffic analytics to know which documents your users are reading. + This allows you to understand how your documentation is being used and learn more about your audience. + Then you can prioritize your efforts on expanding and updating pages people are reading most. + {% endblocktrans %} +
+
+ -
-
{% endwith %} diff --git a/src/js/project/index.js b/src/js/project/index.js index 75966674..bab16445 100644 --- a/src/js/project/index.js +++ b/src/js/project/index.js @@ -237,3 +237,26 @@ export class VersionListItemView extends APIListItemView { } } Registry.add_view(VersionListItemView); + +export class ProjectAnnouncementView { + static view_name = "ProjectAnnouncementView"; + + constructor(cache_key) { + this.cache_key = cache_key; + this.prefix_key = "announcements"; + this.storage_key = `${this.prefix_key}.${this.cache_key}`; + this.closed = ko.observable(); + const cached_value = localStorage.getItem(this.storage_key); + if (cached_value) { + this.closed(true); + } else { + this.closed(false); + } + } + + close_announcement() { + this.closed(true); + localStorage.setItem(this.storage_key, true); + } +} +Registry.add_view(ProjectAnnouncementView); From 0dbffb7196641a58af9341953d5c8026b7f3d446 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 11 Jun 2024 19:27:25 +0200 Subject: [PATCH 2/2] Add the hide button logic to all the announcements --- .../partials/dashboard/example-projects.html | 30 ++++++++++--------- .../dashboard/pull-request-previews.html | 29 ++++++++++-------- .../partials/dashboard/ruby-support.html | 30 ++++++++++--------- .../partials/dashboard/security-logs.html | 30 ++++++++++--------- .../partials/dashboard/traffic-analytics.html | 2 +- 5 files changed, 65 insertions(+), 56 deletions(-) diff --git a/readthedocsext/theme/templates/projects/partials/dashboard/example-projects.html b/readthedocsext/theme/templates/projects/partials/dashboard/example-projects.html index aeb61d0d..c568717d 100644 --- a/readthedocsext/theme/templates/projects/partials/dashboard/example-projects.html +++ b/readthedocsext/theme/templates/projects/partials/dashboard/example-projects.html @@ -1,20 +1,22 @@ {% load i18n %} {% with "https://docs.readthedocs.io/page/examples.html" as url %} -
-
- {% trans "Get inspiration from example projects" %} -
- {% blocktrans %} - Not sure how to get started? - Check out these example projects for a few common tools to get some inspiration. - {% endblocktrans %} +
+ - -
{% endwith %} diff --git a/readthedocsext/theme/templates/projects/partials/dashboard/pull-request-previews.html b/readthedocsext/theme/templates/projects/partials/dashboard/pull-request-previews.html index ba287dd5..2ed97ef4 100644 --- a/readthedocsext/theme/templates/projects/partials/dashboard/pull-request-previews.html +++ b/readthedocsext/theme/templates/projects/partials/dashboard/pull-request-previews.html @@ -1,20 +1,23 @@ {% load i18n %} {% with "https://docs.readthedocs.io/page/pull-requests.html" as url %} -
-
- {% trans "Preview changes before deploying!" %} -
- {% blocktrans %} - Automatically build, preview, and share documentation with every pull request - and easily catch issues before going live. - {% endblocktrans %} +
+ -
{% endwith %} diff --git a/readthedocsext/theme/templates/projects/partials/dashboard/ruby-support.html b/readthedocsext/theme/templates/projects/partials/dashboard/ruby-support.html index 272ff48b..f7eccf59 100644 --- a/readthedocsext/theme/templates/projects/partials/dashboard/ruby-support.html +++ b/readthedocsext/theme/templates/projects/partials/dashboard/ruby-support.html @@ -1,20 +1,22 @@ {% load i18n %} {% with "https://about.readthedocs.com/blog/2024/03/read-the-docs-loves-ruby/" as url %} -
-
- {% trans "New: support for Ruby" %} -
- {% blocktrans %} - Does your project use Jekyll, RDoc, or YARD? - Ruby is now officially supported on Read the Docs as a pre-defined build tool option! - {% endblocktrans %} +
+ - -
{% endwith %} diff --git a/readthedocsext/theme/templates/projects/partials/dashboard/security-logs.html b/readthedocsext/theme/templates/projects/partials/dashboard/security-logs.html index 97610718..1e965e0d 100644 --- a/readthedocsext/theme/templates/projects/partials/dashboard/security-logs.html +++ b/readthedocsext/theme/templates/projects/partials/dashboard/security-logs.html @@ -1,20 +1,22 @@ {% load i18n %} {% with "https://docs.readthedocs.io/page/security-log.html" as url %} -
-
- {% trans "Monitor your organization with security logs" %} -
- {% blocktrans %} - Security logs allow you to audit activity around logins and team changes within your organization. - We store the IP address and the browser on each event, so that you can confirm this access was from the right person. - {% endblocktrans %} +
+ - -
{% endwith %} diff --git a/readthedocsext/theme/templates/projects/partials/dashboard/traffic-analytics.html b/readthedocsext/theme/templates/projects/partials/dashboard/traffic-analytics.html index d45894b8..be9941df 100644 --- a/readthedocsext/theme/templates/projects/partials/dashboard/traffic-analytics.html +++ b/readthedocsext/theme/templates/projects/partials/dashboard/traffic-analytics.html @@ -2,7 +2,7 @@ {% with "https://docs.readthedocs.io/page/analytics.html" as url %}