diff --git a/code/modules/client/asset_cache.dm b/code/modules/client/asset_cache.dm new file mode 100644 index 0000000000..750ac88a3b --- /dev/null +++ b/code/modules/client/asset_cache.dm @@ -0,0 +1,241 @@ +/* +Asset cache quick users guide: + +Make a datum at the bottom of this file with your assets for your thing. +The simple subsystem will most like be of use for most cases. +Then call get_asset_datum() with the type of the datum you created and store the return +Then call .send(client) on that stored return value. + +You can set verify to TRUE if you want send() to sleep until the client has the assets. +*/ + + +// Amount of time(ds) MAX to send per asset, if this get exceeded we cancel the sleeping. +// This is doubled for the first asset, then added per asset after +#define ASSET_CACHE_SEND_TIMEOUT 7 + +//When sending mutiple assets, how many before we give the client a quaint little sending resources message +#define ASSET_CACHE_TELL_CLIENT_AMOUNT 8 + +//List of ALL assets for the above, format is list(filename = asset). +/var/global/list/asset_cache = list() + +/client + var/list/cache = list() // List of all assets sent to this client by the asset cache. + var/list/completed_asset_jobs = list() // List of all completed jobs, awaiting acknowledgement. + var/list/sending = list() + var/last_asset_job = 0 // Last job done. + +//This proc sends the asset to the client, but only if it needs it. +//This proc blocks(sleeps) unless verify is set to false +/proc/send_asset(var/client/client, var/asset_name, var/verify = TRUE) + if(!istype(client)) + if(ismob(client)) + var/mob/M = client + if(M.client) + client = M.client + + else + return 0 + + else + return 0 + + if(client.cache.Find(asset_name) || client.sending.Find(asset_name)) + return 0 + + client << browse_rsc(asset_cache[asset_name], asset_name) + if(!verify || !winexists(client, "asset_cache_browser")) // Can't access the asset cache browser, rip. + if (client) + client.cache += asset_name + return 1 + if (!client) + return 0 + + client.sending |= asset_name + var/job = ++client.last_asset_job + + client << browse({" + + "}, "window=asset_cache_browser") + + var/t = 0 + var/timeout_time = (ASSET_CACHE_SEND_TIMEOUT * client.sending.len) + ASSET_CACHE_SEND_TIMEOUT + while(client && !client.completed_asset_jobs.Find(job) && t < timeout_time) // Reception is handled in Topic() + sleep(1) // Lock up the caller until this is received. + t++ + + if(client) + client.sending -= asset_name + client.cache |= asset_name + client.completed_asset_jobs -= job + + return 1 + +//This proc blocks(sleeps) unless verify is set to false +/proc/send_asset_list(var/client/client, var/list/asset_list, var/verify = TRUE) + if(!istype(client)) + if(ismob(client)) + var/mob/M = client + if(M.client) + client = M.client + + else + return 0 + + else + return 0 + + var/list/unreceived = asset_list - (client.cache + client.sending) + if(!unreceived || !unreceived.len) + return 0 + if (unreceived.len >= ASSET_CACHE_TELL_CLIENT_AMOUNT) + client << "Sending Resources..." + for(var/asset in unreceived) + if (asset in asset_cache) + client << browse_rsc(asset_cache[asset], asset) + + if(!verify || !winexists(client, "asset_cache_browser")) // Can't access the asset cache browser, rip. + if (client) + client.cache += unreceived + return 1 + if (!client) + return 0 + client.sending |= unreceived + var/job = ++client.last_asset_job + + client << browse({" + + "}, "window=asset_cache_browser") + + var/t = 0 + var/timeout_time = ASSET_CACHE_SEND_TIMEOUT * client.sending.len + while(client && !client.completed_asset_jobs.Find(job) && t < timeout_time) // Reception is handled in Topic() + sleep(1) // Lock up the caller until this is received. + t++ + + if(client) + client.sending -= unreceived + client.cache |= unreceived + client.completed_asset_jobs -= job + + return 1 + +//This proc will download the files without clogging up the browse() queue, used for passively sending files on connection start. +//The proc calls procs that sleep for long times. +proc/getFilesSlow(var/client/client, var/list/files, var/register_asset = TRUE) + for(var/file in files) + if (!client) + break + if (register_asset) + register_asset(file,files[file]) + send_asset(client,file) + sleep(-1) //queuing calls like this too quickly can cause issues in some client versions + +//This proc "registers" an asset, it adds it to the cache for further use, you cannot touch it from this point on or you'll fuck things up. +//if it's an icon or something be careful, you'll have to copy it before further use. +/proc/register_asset(var/asset_name, var/asset) + asset_cache[asset_name] = asset + +//From here on out it's populating the asset cache. +/proc/populate_asset_cache() + for(var/type in typesof(/datum/asset) - list(/datum/asset, /datum/asset/simple)) + var/datum/asset/A = new type() + A.register() + + for(var/client/C in clients) + //doing this to a client too soon after they've connected can cause issues, also the proc we call sleeps + spawn(10) + getFilesSlow(C, asset_cache, FALSE) + +//These datums are used to populate the asset cache, the proc "register()" does this. + +//all of our asset datums, used for referring to these later +/var/global/list/asset_datums = list() + +//get a assetdatum or make a new one +/proc/get_asset_datum(var/type) + if (!(type in asset_datums)) + return new type() + return asset_datums[type] + +/datum/asset/New() + asset_datums[type] = src + +/datum/asset/proc/register() + return + +/datum/asset/proc/send(client) + return + +//If you don't need anything complicated. +/datum/asset/simple + var/assets = list() + var/verify = FALSE + +/datum/asset/simple/register() + for(var/asset_name in assets) + register_asset(asset_name, assets[asset_name]) +/datum/asset/simple/send(client) + send_asset_list(client,assets,verify) + + +//DEFINITIONS FOR ASSET DATUMS START HERE. +/datum/asset/simple/paper + assets = list( + "large_stamp-clown.png" = 'icons/paper_icons/large_stamp-clown.png', + "large_stamp-deny.png" = 'icons/paper_icons/large_stamp-deny.png', + "large_stamp-ok.png" = 'icons/paper_icons/large_stamp-ok.png', + "large_stamp-hop.png" = 'icons/paper_icons/large_stamp-hop.png', + "large_stamp-cmo.png" = 'icons/paper_icons/large_stamp-cmo.png', + "large_stamp-ce.png" = 'icons/paper_icons/large_stamp-ce.png', + "large_stamp-hos.png" = 'icons/paper_icons/large_stamp-hos.png', + "large_stamp-rd.png" = 'icons/paper_icons/large_stamp-rd.png', + "large_stamp-cap.png" = 'icons/paper_icons/large_stamp-cap.png', + "large_stamp-qm.png" = 'icons/paper_icons/large_stamp-qm.png', + "large_stamp-law.png" = 'icons/paper_icons/large_stamp-law.png', + "large_stamp-cent.png" = 'icons/paper_icons/large_stamp-cent.png', + "talisman.png" = 'icons/paper_icons/talisman.png', + "ntlogo.png" = 'icons/paper_icons/ntlogo.png' + ) + +/datum/asset/nanoui + var/list/common = list() + + var/list/common_dirs = list( + "nano/assets/", + "nano/css/", + "nano/js/", + "nano/images/", + "nano/layouts/" + ) + var/list/uncommon_dirs = list( + "nano/templates/" + ) + +/datum/asset/nanoui/register() + // Crawl the directories to find files. + for (var/path in common_dirs) + var/list/filenames = flist(path) + for(var/filename in filenames) + if(copytext(filename, length(filename)) != "/") // Ignore directories. + if(fexists(path + filename)) + common[filename] = fcopy_rsc(path + filename) + register_asset(filename, common[filename]) + for (var/path in uncommon_dirs) + var/list/filenames = flist(path) + for(var/filename in filenames) + if(copytext(filename, length(filename)) != "/") // Ignore directories. + if(fexists(path + filename)) + register_asset(filename, fcopy_rsc(path + filename)) + +/datum/asset/nanoui/send(client, uncommon) + if(!islist(uncommon)) + uncommon = list(uncommon) + + send_asset_list(client, uncommon) + send_asset_list(client, common) diff --git a/icons/paper_icons/large_stamp-cap.png b/icons/paper_icons/large_stamp-cap.png new file mode 100644 index 0000000000..7f7ce460a4 Binary files /dev/null and b/icons/paper_icons/large_stamp-cap.png differ diff --git a/icons/paper_icons/large_stamp-ce.png b/icons/paper_icons/large_stamp-ce.png new file mode 100644 index 0000000000..189db310cf Binary files /dev/null and b/icons/paper_icons/large_stamp-ce.png differ diff --git a/icons/paper_icons/large_stamp-cent.png b/icons/paper_icons/large_stamp-cent.png new file mode 100644 index 0000000000..08770fdf60 Binary files /dev/null and b/icons/paper_icons/large_stamp-cent.png differ diff --git a/icons/paper_icons/large_stamp-clown.png b/icons/paper_icons/large_stamp-clown.png new file mode 100644 index 0000000000..5abbff7113 Binary files /dev/null and b/icons/paper_icons/large_stamp-clown.png differ diff --git a/icons/paper_icons/large_stamp-cmo.png b/icons/paper_icons/large_stamp-cmo.png new file mode 100644 index 0000000000..eb004be621 Binary files /dev/null and b/icons/paper_icons/large_stamp-cmo.png differ diff --git a/icons/paper_icons/large_stamp-deny.png b/icons/paper_icons/large_stamp-deny.png new file mode 100644 index 0000000000..7c216fce48 Binary files /dev/null and b/icons/paper_icons/large_stamp-deny.png differ diff --git a/icons/paper_icons/large_stamp-hop.png b/icons/paper_icons/large_stamp-hop.png new file mode 100644 index 0000000000..3f9aa4a76f Binary files /dev/null and b/icons/paper_icons/large_stamp-hop.png differ diff --git a/icons/paper_icons/large_stamp-hos.png b/icons/paper_icons/large_stamp-hos.png new file mode 100644 index 0000000000..67b69d7503 Binary files /dev/null and b/icons/paper_icons/large_stamp-hos.png differ diff --git a/icons/paper_icons/large_stamp-law.png b/icons/paper_icons/large_stamp-law.png new file mode 100644 index 0000000000..d6d77eee9b Binary files /dev/null and b/icons/paper_icons/large_stamp-law.png differ diff --git a/icons/paper_icons/large_stamp-ok.png b/icons/paper_icons/large_stamp-ok.png new file mode 100644 index 0000000000..e568ae0921 Binary files /dev/null and b/icons/paper_icons/large_stamp-ok.png differ diff --git a/icons/paper_icons/large_stamp-qm.png b/icons/paper_icons/large_stamp-qm.png new file mode 100644 index 0000000000..ea863078b4 Binary files /dev/null and b/icons/paper_icons/large_stamp-qm.png differ diff --git a/icons/paper_icons/large_stamp-rd.png b/icons/paper_icons/large_stamp-rd.png new file mode 100644 index 0000000000..35479e805f Binary files /dev/null and b/icons/paper_icons/large_stamp-rd.png differ diff --git a/icons/paper_icons/ntlogo.png b/icons/paper_icons/ntlogo.png new file mode 100644 index 0000000000..d5614a964e Binary files /dev/null and b/icons/paper_icons/ntlogo.png differ diff --git a/icons/paper_icons/talisman.png b/icons/paper_icons/talisman.png new file mode 100644 index 0000000000..0ece637314 Binary files /dev/null and b/icons/paper_icons/talisman.png differ diff --git a/nano/.gitignore b/nano/.gitignore new file mode 100644 index 0000000000..4a688ff055 --- /dev/null +++ b/nano/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +bower_components/ \ No newline at end of file diff --git a/nano/Gulpfile.coffee b/nano/Gulpfile.coffee new file mode 100644 index 0000000000..a8c604a228 --- /dev/null +++ b/nano/Gulpfile.coffee @@ -0,0 +1,108 @@ +### Settings ### +util = require("gulp-util") +s = + min: util.env.min + +# Project Paths +input = + fonts: "**/*.{eot,woff2}" + images: "images" + layouts: "layouts/" + scripts: + lib: "scripts/libraries" + main: "scripts/nano" + styles: "styles" + templates: "templates/" + +output = + dir: "assets" + scripts: + lib: "libraries.min.js" + main: "nano.js" + css: "nanoui.css" + +### Pacakages ### +bower = require "main-bower-files" +child_process = require "child_process" +del = require "del" +gulp = require "gulp" +merge = require "merge-stream" + +### Plugins ### +g = require("gulp-load-plugins")({replaceString: /^gulp(-|\.)|-/g}) +p = + autoprefixer: require "autoprefixer" + gradient: require "postcss-filter-gradient" + opacity: require "postcss-opacity" + rgba: require "postcss-color-rgba-fallback" + plsfilters: require "pleeease-filters" + + +### Helpers ### + +glob = (path) -> + "#{path}/*" + +### Tasks ### +gulp.task "default", ["fonts", "scripts", "styles"] + +gulp.task "clean", -> + del glob output.dir + +gulp.task "watch", -> + gulp.watch [glob input.images], ["reload"] + gulp.watch [glob input.layouts], ["reload"] + gulp.watch [glob input.scripts.lib], ["reload"] + gulp.watch [glob input.scripts.main], ["reload"] + gulp.watch [glob input.styles], ["reload"] + gulp.watch [glob input.templates], ["reload"] + +gulp.task "reload", ["default"], -> + child_process.exec "reload.bat", (err, stdout, stderr) -> + return console.log err if err + + +gulp.task "fonts", ["clean"], -> + gulp.src bower input.fonts + .pipe gulp.dest output.dir + +gulp.task "scripts", ["clean"], -> + lib = gulp.src glob input.scripts.lib + etc = gulp.src bower "**/*.js" + + merged = merge lib, etc + .pipe g.order(["jquery.js", + "jquery*.js", + "*.js"]) + .pipe g.concat(output.scripts.lib) + .pipe g.if(s.min, g.uglify().on('error', util.log)) + .pipe gulp.dest output.dir + + main = gulp.src glob input.scripts.main + .pipe g.order(["nano_utility.js", + "nano_state_manager.js" + "*.js"]) + .pipe g.concat(output.scripts.main) + .pipe g.if(s.min, g.uglify().on('error', util.log)) + .pipe gulp.dest output.dir + +gulp.task "styles", ["clean"], -> + lib = gulp.src bower "**/*.css" + .pipe g.replace("../fonts/", "") + + main = gulp.src glob input.styles + .pipe g.filter(["*.less", "!_*.less"]) + .pipe g.less({paths: [input.images]}) + .pipe g.postcss([ + p.autoprefixer({browsers: ["last 2 versions", "ie >= 8"]}), + p.gradient, + p.opacity, + p.rgba({oldie: true}), + p.plsfilters({oldIE: true}) + ]) + + combined = merge lib, main + combined + .pipe g.if(s.min, g.cssnano({discardComments: {removeAll: true}}), g.csscomb()) + .pipe g.concat(output.css) + .pipe gulp.dest output.dir \ No newline at end of file diff --git a/nano/Gulpfile.js b/nano/Gulpfile.js new file mode 100644 index 0000000000..203c68bf5c --- /dev/null +++ b/nano/Gulpfile.js @@ -0,0 +1,2 @@ +require('coffee-script/register'); +require('./Gulpfile.coffee'); diff --git a/nano/README.md b/nano/README.md new file mode 100644 index 0000000000..30da5745bd --- /dev/null +++ b/nano/README.md @@ -0,0 +1,78 @@ +# NanoUI + +NanoUI is a user interface library, used for over 100 different interfaces, and rising. +It is more complicated than the other two UI systems in use, the `/datum/browser` and +`browse()` systems, but offers pre-made libraries, JavaScript, and a modified doT +template engine. + +This README is not yet complete, but gives a basic rundown of how the folder structure +works. I'll get around to finishing it one day. + +## Folder Rundown + +### /assets +The assets folder is used by the Gulp compiling system, and stores the minified version of +the NanoUI JavaScript Library and prerequisites. Everything within this folder is sent to +the client as-is. + +### /codemirror +This folder contains all of the JavaScript and CSS for CodeMirror. It is sent to the +client as-is. CodeMirror only has it's own folder due to the fact that it can't be +directly compiled into the NanoUI files. + +### /images +This folder is used to store any image files. It is sent to the client as-is. + +### /layouts +This folder is used for the central "layout" template files, which is loaded before the +UI's actual template file. It is sent to the client as-is. + +### /scripts +This folder is used for anything that will be compiled by the Gulp compilation system. +Currently, it is split into two folders. The file names must start with a number, as this +is how Gulp decides what order to put the concatenated and possibly minified files in. +Anything within this folder is not sent to the client directly. + +#### /scripts/libraries +This folder is used to store the source code of the prerequisites of NanoUI. Currently, +it contains jQuery, jQuery UI, jQuery timers, and the doT template system. + +#### /scripts/nano +This folder contains the primary JavaScript for NanoUI. + +### /styles +This folder is used for NanoUI's LESS styles. These are compiled via gulp into the file +`nanoui.css`. LESS is a system that expands upon CSS in order to make it better, as well +as less complicated. + +Any LESS file that is prefixed with the `_` character will be ignored during compilation. +These files are still included, however, via `@import`, view the file +[`nanoui.less`](http://github.com/ParadiseSS13/Paradise/blob/master/nano/styles/nanoui.less) to see how this works. + + +### /templates +This folder is used to store the .tmpl files which are later compiled by the NanoUtility +JavaScript, using a modified version of the doT template engine. It is sent to the client +as-is. + +## Compiling +To compile any changes to the NanoUI JavaScript, you must first setup the building +environment. + +### Prerequisites +You will first need to install the primary prerequisite of NanoUI, [Node.js](https://nodejs.org). + +Node.js is used to obtain all of the remaining prerequisites to compile NanoUI. This is +done by running the following commands. + - `npm install -g gulp bower` + - `npm install` + - `bower install` + +### Running Gulp +NanoUI is built using the `gulp` task automation system. This system uses the contents +of the `Gulpfile.js` and `Gulpfile.coffee` files to perform compilation tasks. + +In order to build an un-minified version of NanoUI, you may simply run `gulp` in the +`nanoui` directory. However, this should only be used while testing, and you should run +the command `gulp --min` before commiting changes, in order to produce minified +JavaScript. \ No newline at end of file diff --git a/nano/assets/fontawesome-webfont.eot b/nano/assets/fontawesome-webfont.eot new file mode 100644 index 0000000000..9b6afaedc0 Binary files /dev/null and b/nano/assets/fontawesome-webfont.eot differ diff --git a/nano/assets/fontawesome-webfont.woff2 b/nano/assets/fontawesome-webfont.woff2 new file mode 100644 index 0000000000..500e517253 Binary files /dev/null and b/nano/assets/fontawesome-webfont.woff2 differ diff --git a/nano/assets/libraries.min.js b/nano/assets/libraries.min.js new file mode 100644 index 0000000000..6e3405a7be --- /dev/null +++ b/nano/assets/libraries.min.js @@ -0,0 +1,5 @@ +!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t="length"in e&&e.length,n=oe.type(e);return"function"===n||oe.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function i(e,t,n){if(oe.isFunction(t))return oe.grep(e,function(e,i){return!!t.call(e,i,e)!==n});if(t.nodeType)return oe.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(pe.test(t))return oe.filter(t,e,n);t=oe.filter(t,e)}return oe.grep(e,function(e){return oe.inArray(e,t)>=0!==n})}function o(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function r(e){var t=xe[e]={};return oe.each(e.match(be)||[],function(e,n){t[n]=!0}),t}function s(){he.addEventListener?(he.removeEventListener("DOMContentLoaded",a,!1),e.removeEventListener("load",a,!1)):(he.detachEvent("onreadystatechange",a),e.detachEvent("onload",a))}function a(){(he.addEventListener||"load"===event.type||"complete"===he.readyState)&&(s(),oe.ready())}function l(e,t,n){if(void 0===n&&1===e.nodeType){var i="data-"+t.replace(Ne,"-$1").toLowerCase();if(n=e.getAttribute(i),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:_e.test(n)?oe.parseJSON(n):n}catch(o){}oe.data(e,t,n)}else n=void 0}return n}function u(e){var t;for(t in e)if(("data"!==t||!oe.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,i){if(oe.acceptData(e)){var o,r,s=oe.expando,a=e.nodeType,l=a?oe.cache:e,u=a?e[s]:e[s]&&s;if(u&&l[u]&&(i||l[u].data)||void 0!==n||"string"!=typeof t)return u||(u=a?e[s]=Y.pop()||oe.guid++:s),l[u]||(l[u]=a?{}:{toJSON:oe.noop}),"object"!=typeof t&&"function"!=typeof t||(i?l[u]=oe.extend(l[u],t):l[u].data=oe.extend(l[u].data,t)),r=l[u],i||(r.data||(r.data={}),r=r.data),void 0!==n&&(r[oe.camelCase(t)]=n),"string"==typeof t?(o=r[t],null==o&&(o=r[oe.camelCase(t)])):o=r,o}}function f(e,t,n){if(oe.acceptData(e)){var i,o,r=e.nodeType,s=r?oe.cache:e,a=r?e[oe.expando]:oe.expando;if(s[a]){if(t&&(i=n?s[a]:s[a].data)){oe.isArray(t)?t=t.concat(oe.map(t,oe.camelCase)):t in i?t=[t]:(t=oe.camelCase(t),t=t in i?[t]:t.split(" ")),o=t.length;for(;o--;)delete i[t[o]];if(n?!u(i):!oe.isEmptyObject(i))return}(n||(delete s[a].data,u(s[a])))&&(r?oe.cleanData([e],!0):ne.deleteExpando||s!=s.window?delete s[a]:s[a]=null)}}}function p(){return!0}function d(){return!1}function h(){try{return he.activeElement}catch(e){}}function g(e){var t=We.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function m(e,t){var n,i,o=0,r=typeof e.getElementsByTagName!==Ce?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==Ce?e.querySelectorAll(t||"*"):void 0;if(!r)for(r=[],n=e.childNodes||e;null!=(i=n[o]);o++)!t||oe.nodeName(i,t)?r.push(i):oe.merge(r,m(i,t));return void 0===t||t&&oe.nodeName(e,t)?oe.merge([e],r):r}function v(e){He.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t){return oe.nodeName(e,"table")&&oe.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function b(e){return e.type=(null!==oe.find.attr(e,"type"))+"/"+e.type,e}function x(e){var t=Qe.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function w(e,t){for(var n,i=0;null!=(n=e[i]);i++)oe._data(n,"globalEval",!t||oe._data(t[i],"globalEval"))}function T(e,t){if(1===t.nodeType&&oe.hasData(e)){var n,i,o,r=oe._data(e),s=oe._data(t,r),a=r.events;if(a){delete s.handle,s.events={};for(n in a)for(i=0,o=a[n].length;o>i;i++)oe.event.add(t,n,a[n][i])}s.data&&(s.data=oe.extend({},s.data))}}function C(e,t){var n,i,o;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!ne.noCloneEvent&&t[oe.expando]){o=oe._data(t);for(i in o.events)oe.removeEvent(t,i,o.handle);t.removeAttribute(oe.expando)}"script"===n&&t.text!==e.text?(b(t).text=e.text,x(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),ne.html5Clone&&e.innerHTML&&!oe.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&He.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}}function _(t,n){var i,o=oe(n.createElement(t)).appendTo(n.body),r=e.getDefaultComputedStyle&&(i=e.getDefaultComputedStyle(o[0]))?i.display:oe.css(o[0],"display");return o.detach(),r}function N(e){var t=he,n=Ze[e];return n||(n=_(e,t),"none"!==n&&n||(Je=(Je||oe("