go-dy/html/assets/side-channel-0c5db805.js
2025-10-28 16:50:24 +08:00

2 lines
1.2 KiB
JavaScript

import{g as e}from"./get-intrinsic-3ea43993.js";import{a as t}from"./call-bind-af784638.js";import{o as n}from"./object-inspect-843295b9.js";var o=e,r=t,a=n,f=o("%TypeError%"),i=o("%WeakMap%",!0),p=o("%Map%",!0),u=r("WeakMap.prototype.get",!0),s=r("WeakMap.prototype.set",!0),c=r("WeakMap.prototype.has",!0),y=r("Map.prototype.get",!0),l=r("Map.prototype.set",!0),x=r("Map.prototype.has",!0),v=function(e,t){for(var n,o=e;null!==(n=o.next);o=n)if(n.key===t)return o.next=n.next,n.next=e.next,e.next=n,n},M=function(){var e,t,n,o={assert:function(e){if(!o.has(e))throw new f("Side channel does not contain "+a(e))},get:function(o){if(i&&o&&("object"==typeof o||"function"==typeof o)){if(e)return u(e,o)}else if(p){if(t)return y(t,o)}else if(n)return function(e,t){var n=v(e,t);return n&&n.value}(n,o)},has:function(o){if(i&&o&&("object"==typeof o||"function"==typeof o)){if(e)return c(e,o)}else if(p){if(t)return x(t,o)}else if(n)return function(e,t){return!!v(e,t)}(n,o);return!1},set:function(o,r){i&&o&&("object"==typeof o||"function"==typeof o)?(e||(e=new i),s(e,o,r)):p?(t||(t=new p),l(t,o,r)):(n||(n={key:{},next:null}),function(e,t,n){var o=v(e,t);o?o.value=n:e.next={key:t,next:e.next,value:n}}(n,o,r))}};return o};export{M as s};